Last Updated: February 25, 2016
·
1.021K
· rodrigoflores

Easily check directories sizes

Sometimes I wanna check the size of some directories and see how much space they're occupying. Log files can get really big if you don't truncate them from time to time.

An easy way to do that is through the command line utility du

To see this list of directories and the size of them, type

du -d 1 -h 

-d is the argument for the depth of directories that should be shown and its sizes and -h is argument for human output of sizes (it adds the K suffix when kilobyte, M when megabyte and so on).

2 Responses
Add your response

Yeah often I use 'du -sh *'

over 1 year ago ·

Sometimes you need to be root to read folders. And it's useful to sort results by size. So:
alias dus = 'sudo du -hs *|sort -h'

over 1 year ago ·