[ILUG] ugly df

Paul Reilly paulr at maths.tcd.ie
Fri Nov 10 16:46:24 GMT 2006


Anyone know a simple way to make df display it's output nicely?

For example, I'd like it to display all the real disks partns
together in the order they are listed in fstab

So instead of this:

Filesystem            Size  Used Avail Use% Mounted on
/dev/sda1             1.1G  128M  889M  13% /
tmpfs                 1.9G     0  1.9G   0% /dev/shm
/dev/sda2             2.8G  320M  2.4G  12% /usr
/dev/sda3             897M  151M  699M  18% /var
/dev/sda5             265M  8.1M  243M   4% /tmp
/dev/sda6             9.2G  4.1G  4.7G  47% /home
tmpfs                  10M  180K  9.9M   2% /dev

Like this:

Filesystem            Size  Used Avail Use% Mounted on
/dev/sda1             1.1G  128M  889M  13% /
/dev/sda2             2.8G  320M  2.4G  12% /usr
/dev/sda3             897M  151M  699M  18% /var
/dev/sda5             265M  8.1M  243M   4% /tmp
/dev/sda6             9.2G  4.1G  4.7G  47% /home
tmpfs                 1.9G     0  1.9G   0% /dev/shm
tmpfs                  10M  180K  9.9M   2% /dev

Also for long LVM volume names, like:

/dev/mapper/bigvg_webdisk
                       4.3G   143M   3.9G   4% /var/www

It should not wrap over two lines, but just expand the column width.
df doesn't seem to notice COLUMNS environment.

I suppose you could do this by recompiling, or wrapping 'df' in some
script to format it nicely. But there must be a better way.
Any ideas?

FYI - this is 'df' from coreutils 5.65 on debian etch.

Paul



More information about the ILUG mailing list