Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

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

As the title stated, I'm getting a drive warning via email from my server. I was told to use the following command to determine where the disk space usage is coming from. Is it possible for me to sort the results based on disk usage? It returns a long list that is hard to sort through...

du -h --max-depth=2 /usr


What kind of data is stored here?

share|improve this question
up vote 4 down vote accepted
du --max-depth=2 /usr | sort -n | less

sorts the output and less allows to scroll up again

share|improve this answer
Also the -b option to du will give you bytes used. – Andrew Jul 24 '10 at 12:53
Add the "-h" option to get human readable in MegaBytes – John Jul 24 '10 at 16:40
can sort handle the abbreviations? – krissi Jul 24 '10 at 17:20
No. If you're passing it into sort, then don't use -h. Use -b, -k or -m. – Bill Lynch Jul 24 '10 at 18:06
That just outputs blank lines... – Webnet Jul 28 '10 at 12:18

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.