
Visualize Disk Space in Linux: A Guide to the colordf Command
For system administrators and Linux power users, the df command is a daily workhorse. It’s the go-to utility for checking disk space usage across all mounted filesystems. While incredibly functional, its standard output is a wall of monochrome text that can be difficult to scan quickly, especially when you’re looking for partitions that are nearing capacity.
What if you could make that output instantly readable and visually intuitive? That’s precisely what colordf does. This simple yet powerful tool is a wrapper for the standard df command, enhancing its output with color-coding to provide an at-a-glance overview of your system’s storage health.
What is colordf and Why Should You Use It?
colordf is a lightweight Perl script that takes the output of the df command and presents it with colors based on disk usage percentages. It doesn’t replace df; it enhances it, making critical information jump off the screen.
The primary benefit is immediate clarity. Instead of scanning numbers in a “Use%” column, you can rely on a simple, universal color scheme:
- Green: Healthy disk usage with plenty of free space.
- Yellow/Orange: A warning that the partition is starting to fill up.
- Red: A critical alert indicating the disk is nearing or at full capacity.
This visual feedback loop allows you to identify potential storage issues in seconds, improving your efficiency and helping you proactively manage your system resources before they become a problem.
Key Features of colordf
While its main feature is color, colordf offers a surprising amount of flexibility, making it an essential tool for any serious Linux user.
- Intuitive Health Checks: The color-coded system is the core feature. It transforms data into actionable insight, allowing you to prioritize which filesystems need attention without carefully reading every single line.
- Full Customization:
colordfis not a one-size-fits-all tool. It uses a configuration file, typically located at/etc/colordfrc, which you can copy to your home directory (~/.colordfrc) for personal customization. Here, you can define your own color schemes, set custom percentage thresholds for warnings and critical alerts, and even specify which filesystem types to include or ignore. - Seamless Integration: Because it acts as a wrapper,
colordfaccepts the same arguments as the standarddfcommand. This means you can continue using familiar flags like-h(human-readable) or-T(show filesystem type) without changing your workflow. For ultimate convenience, you can create a shell alias to makedfautomatically runcolordf.
How to Install and Configure colordf
Getting started with colordf is incredibly straightforward, as it’s available in the default repositories of most major Linux distributions.
Installation:
- On Debian/Ubuntu-based systems:
bash
sudo apt-get install colordf
- On RHEL/CentOS/Fedora systems:
bash
sudo yum install colordf
or
bash
sudo dnf install colordf
Basic Usage:
Once installed, simply run the command:
colordf
You will immediately see the familiar output of df, but with the added benefit of color.
Actionable Security Tip: Create a Permanent Alias
To make colordf your default disk usage command, you should create a shell alias. This automatically replaces any call to df with colordf, ensuring you always get the enhanced, colorful output.
- Open your shell’s configuration file. This is usually
~/.bashrcfor Bash or~/.zshrcfor Zsh. - Add the following line to the end of the file:
bash
alias df='colordf'
- Save the file and reload your shell’s configuration by running
source ~/.bashrc(or the equivalent for your shell) or by simply opening a new terminal window.
Now, whenever you type df -h, your system will automatically execute colordf -h, giving you the visually optimized output every time. This simple change can significantly improve your system monitoring workflow with minimal effort.
Source: https://www.linuxlinks.com/colordf-colored-configurable-df/


