Show Disk Space Usage (Sorted)


Every once and awhile I find myself needed to what is the space hog on my computer/server. While the command du – h in the command line works for a general overview – I really want to see the results in descending order (by space used). This command will list out everything in descending order so you can quickly see where the most space is used:

du -k -s * | sort -k1 -g -r

One thought on “Show Disk Space Usage (Sorted)”

  1. David Moffatt

    Actually Jen’s method is a bad way to do it. It will miss any hidden (ie begining with “.”) directories at the top leve, eg .svn, which can be quite large.

    Jen’s method has the biggest directories at the top. This means you need to pipe things to more. This has them at the bottom which is actually much more useful. (try it and you see why)

    du . | sort -n

Leave a Reply

Your email address will not be published.

This site uses Akismet to reduce spam. Learn how your comment data is processed.