Article by Alessio Bash, published in Italian on his nice ArchLinux Blog
Check constantly your disk or its partitions is one of the essential things in a linux system. Today users usually checks this through graphical tools, but the real Linux old-timers use a terminal and the command “
df“. Today I want to show you how to use “
dfc“, similar to df but with the addition of colors and a percentage bar. You know, sometimes the eyes wants their part!
dfc the available size correspond to the space available to a user point of view and not from root’s perspective (ie: use f_bavail instead of f_bfree). In the same idea, used space is computed simply by substracting the available space from the total size.
Without any argument, size is displayed in human readable format. Be aware that when using human-readable format, there might be some rounding when computing the size. If you want maximum precision, use the “-u” option and choose the unit.
Let’s start with installing the package. The ones that use the repositories “archlinuxfr”, will be able to install the package from both this repository and AUR. Obviously I recommend compiling it from the AUR. So open our friend terminal and run the command:
$ yaourt -Sy aur/dfc
in this way you will install the package from AUR.
[Ubuntu - Mint - Debian]
The package is availabe in the main repository so you can install it with the command:
sudo apt-get install dfc
The installation is now complete and you can run the command:
And you’ll get an output like this one:
In my opinion the percentage bar that shows the percentage of used space it’s very useful to see at a glance if you have any problem on your filesystems, the color is based on the % of used space.
dfc has it’s own flags that you can activate to get more information on your filesystems, the most useful are:
-a print all fs from mtab
-i info about inodes
-T show filesystem type
-u choose the unit in which to show the values. UNIT can take one of the following value:
- “h”: Human readable (default when not using “-u” option).
- “b”: Show bytes.
- “k”: Show size using Kio.
- “m”: Show size using Mio.
- “g”: Show size using Gio.
- “t”: Show size using Tio.
This is another example of output with some options activated:
And as last thing, if you want, you can create an alias in you .bashrc to map the command “df” as “dfc”. Just open the file .bashrc and insert this line:
Now every time you type
df on your terminal you’ll have a different and nicer output.
- The legacy of Mandrake Linux: Rosa Linux
- Linux Terminal: How to color the output in bash scripts
- Linux Terminal: Manage Processes with killall and kill
- Play your Music on Linux with Music Player Daemon
- How to measure memory usage in Linux
Find me on Google+