LINUX.IE, website of the Irish Linux Users' Group
Tux rules!

   
Home
New Users
Articles
Download
Projects
Community
Vendors

  Print Version
Email to...
 
Archives:


planetILUG

Recent News

News Archive


Join the
ILUG
on FaceBook


Join the
ILUG
on LinkedIn


Join the
ILUG SETI
Group



















 
 :: Mailing Lists

[ILUG] ugly df

[ILUG] ugly df

Josh Glover 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. :)

-Josh



More information about the ILUG mailing list
Read this without the formatting.
                                                                                                    

 

Hosted by HEAnet


Maintained by the ILUG website team. The aim of Linux.ie is to support and help commercial and private users of Linux in Ireland. You can display ILUG news in your own webpages, read backend information to find out how. Networking services kindly provided by HEAnet, server kindly donated by Dell. Linux is a trademark of Linus Torvalds, used with permission. No penguins were harmed in the production or maintenance of this highly praised website. Looking for the Indian Linux Users' Group? Try here. If you've read all this and aren't a lawyer: you should be!
RSS Version
Powered by Dell