Use df and GNU sort to investigate hard drive usage

Friday, 16. July 2010

The standard UNIX utility df and and GNU’s sort implementation can be used in conjunction as a handy way to explore hard drive usage.

du -hs * | sort -h

This command will sort all files in the current working directory by human-readable size. It’s very convenient if you happen to be wondering where the bulk of your hard drive space is going. The trick here is the use of -h to both df and sort; BSD implementations of df faithfully accept -h, but BSD sort dosen’t accept -h. On BSD, you’ll have to du -s * | sort -n instead and look at big numbers.

2 Responses to “Use df and GNU sort to investigate hard drive usage”



  1. ¿Cuanto ocupan tus archivos en Linux? | Maldito Nerd Says:

    [...] Muy útil para encontrar cual es el archivo ese que ocupa tanto espacio entre millones. Se lo robé a LinuxCommando. [...]



  2. Dan Farrell Says:

    Thanks for the recognition! And in exchange, a link to your blog.

Leave a Reply