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?

du --max-depth=2 /usr | sort -n | less

sorts the output and less allows to scroll up again

  • 1
    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 clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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