List directories size with the command line

Here's how to list a directory size from the terminal.

Get a size sorted list of directories and their estimated size (file space usage) in linux (Ubuntu, in my case).


You can customize how deep you want to go, in the case below only first level folders will be listed.

du -h --max-depth=1 | sort -hr

Sample output

921M . 128M ./02 102M ./03 93M ./01 90M ./06 88M ./05 81M ./04 74M ./09 71M ./11 70M ./12 53M ./10 43M ./07 32M ./08

About Ricard Torres

Senior Front-end Software Engineer at Netcentric, from Barcelona, Haidong Gumdo Instructor (korean martial art of the sword), street photographer, travel lover, TV addict, Boston Red Sox fan, and privacy advocate.

@ricard_dev @ricard_dev

📝 Blog 🎙 Podcast

Leave a Reply

Add <code> Some Code </code> if you need to.