Quickzi: How To Show The Top Largest Files and Directories

Here is a quick tip on how to display the top largest files and directories within my home directory:

# du -hs /home/adam/* | sort -nr | head

Cheers!

2 thoughts on “Quickzi: How To Show The Top Largest Files and Directories

  1. Just a note, it doesn’t work with the -h (human-readable units) flag if the file sizes are in different units (such as a 16 GB folder and a 599 MB folder) — it only sorts by the raw number, not taking into account the units (so the 599 MB folder would come before the 16 GB folder). If you remove the -h flag, it works fine. Cool trick though.

Leave a Reply

Your email address will not be published. Required fields are marked *

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=""> <strike> <strong>