On Mon, Oct 08, 2007 at 08:18:02AM -0400, Rick Pasotto wrote: > On Mon, Oct 08, 2007 at 08:12:33AM -0400, Kevin Mark wrote: > > On Mon, Oct 08, 2007 at 01:46:10PM +0200, Wolodja Wentland wrote: > > > On Mon, 2007-10-08 at 13:24 +0200, roberto wrote: > > > > hello > > > > i use the "df -h" or "du -h"command to check how much disk space is > > > > occupied by files and directories > > > > > > > > but is it possible to sort the output list in an order such that the > > > > first (or conversely the last) item is the largest in size ? > > > > > > You can achieve this by sorting the output produced by df/du like this: > > > > > > "df -h|sort -k2" > > > > > > The "-k2" tells sort to sort by the second column. If you want it sorted > > > in reverse order add the "-r" option. > > > > > > Hope that answers your question > > I think you missed someting? like the -n flag? If you do a normal sort, > > its alphabetic. With -n, it is done numeric. > > That's true but it doesn't help anyway. 57K will sort larger than 2M.
I forgot to mention that I never use the '-h' option for this reason and use '-m'. What use is the 'human' size, when you want to sort numbers by machine, thus you need similar units, unless the sort routine can understnd the -h notation, and unix tools usually avoid this unneeded complexity. -K -- | .''`. == Debian GNU/Linux == | my web site: | | : :' : The Universal |mysite.verizon.net/kevin.mark/| | `. `' Operating System | go to counter.li.org and | | `- http://www.debian.org/ | be counted! #238656 | | my keyserver: subkeys.pgp.net | my NPO: cfsg.org | |join the new debian-community.org to help Debian! | |_______ Unless I ask to be CCd, assume I am subscribed _______| -- To UNSUBSCRIBE, email to [EMAIL PROTECTED] with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]