Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

with the command

du -sh *

I get the summary of files in MB,GB, etc. If I use

du -s * | sort -nk1

I get the summary sort by size.
How I can get the summary sort by size in MB, GB, etc?


the OS is ubuntu

share|improve this question
You didn't mention the OS and/or version of sort you're using. If it's GNU sort replace the -n with a -h. So "du -sh * | sort -hk1,1" – tink Dec 17 '12 at 19:04
@tink you comment solve the question – juanpablo Dec 17 '12 at 19:16
Now I wish I had made it an answer ;D – tink Dec 17 '12 at 19:25
@tink with you comment make a answer for close this question :) – juanpablo Dec 17 '12 at 19:29
up vote 2 down vote accepted

If you're using GNU sort, try the following:

du -sh * | sort -hk1,1
share|improve this answer

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .