bug-coreutils
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: does "df " can list sort by size


From: Evan Hunt
Subject: Re: does "df " can list sort by size
Date: Thu, 18 Jan 2007 15:06:22 -0800
User-agent: Mutt/1.5.10i

Is there some reason you *need* to use the -h option to df?

If not, then just use an option that *doesn't* format the disk
size with M's and G's, such as -k.  Then this will do what you
want:

        df -Pk | tail -n +2 | sort -k3,3n

Or if you want to preserve the header, use a script like this:

        #!/bin/sh
        df -Pk > /tmp/df.$$
        (head -1; sort -k3,3n) < /tmp/df.$$
        rm -f /tmp/df.$$

Evan Hunt

On Thu, Jan 18, 2007 at 09:32:06AM +0800, Samuel Wong wrote:
> Hello ,
> 
> I want to list the usage sort by Size.
> but i use "df -h " can list hd usage sortting random e.g :
> Filesystem Size Used Avail Use% Mounted on
> /dev/md0 9.7G 6.4G 2.8G 70% /
> none 501M 0 501M 0% /dev/shm
> /dev/md3 211G 413M 200G 1% /usr/local
> /dev/md1 4.9G 395M 4.2G 9% /var
> 
> How Can I list sort by Size.
> 
> holp getting voice from you.
> 
> regards.
> Samuel.
> 
> 




reply via email to

[Prev in Thread] Current Thread [Next in Thread]