[ILUG] ugly df
jmglov at wmalumni.com
Fri Nov 10 22:51:20 GMT 2006
On 11/11/06, Paul Reilly <paulr at maths.tcd.ie> wrote:
> Anyone know a simple way to make df display it's output nicely?
Sure. This fact that I call df twice is slightly garbage, but it gets
the job done and I cannot think of another way to not sort the first
line, short of using a tmp file.
: jmglov at laurana; df -h | head -1; df -h | sed -e 1d | sort
Filesystem Size Used Avail Use% Mounted on
/dev/hda3 123M 116M 6.6M 95% /
/dev/hda5 1.9G 710M 1.1G 39% /tmp
/dev/hda6 9.4G 5.1G 4.3G 54% /usr
/dev/hda7 484M 219M 266M 46% /var
/dev/hda8 16G 14G 2.2G 87% /home
none 252M 0 252M 0% /dev/shm
udev 252M 600K 252M 1% /dev
> 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.
Wrapping df in a script, or better yet piping its output to another
program or programs is The Unix Way. Kitchen-sink options-having
programs like GNU ls(1) are not The Unix Way. :)
More information about the ILUG