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

About the Author...

Jennifer Zelazny

My name is Jennifer Zelazny and this site is a collection of my random thoughts and opinions. I am Penn Stater, WordPress developer, and a modern day explorer. I love exploring data, trends, and things that make the world a better place and sharing them here.

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.
You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>
*
*