May 082013
 

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!



In 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.

Installation

[Arch Linux]

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:

$ dfc

And you’ll get an output like this one:

dfc

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.

Useful flags

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:

dfc2

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:

alias df="dfc"

Now every time you type df on your terminal you’ll have a different and nicer output.

Popular Posts:

Flattr this!

  7 Responses to “Linux shell: Dfc – Check your disk space with style”

  1. Hi, looks great but there is no such package in the Ubuntu 12.04 repository. =(

  2. Very nice! I uses df -h about 100X a day. dfc combines the -h by default, and gives some colors to point possible trouble. Thanks!

  3. So where’s the source? Not all of use the distributions you discuss.

  4. Seems to only be available on ubuntu 13 and later. The tarball installs cleanly on 12.04 though. I just had to install cmake before compiling.

  5. You inspired me to blog about using the Open Build Service to create packages for my version of openSUSE in 5 easy steps 😉

    http://blog.jospoortvliet.com/2013/05/building-for-your-version-of-opensuse.html

    Thanks!!!

 Leave a Reply

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>

(required)

(required)

*