You know there is the du
command to fetch the disk usage of a directory (“.
” in this example). By default, output is sorted by directory name, not size:
du -h --max-depth=1 .
40K ./a
2.3G ./b
3.1M ./c
500M ./d
2.8G .
To see which directories take up the most (or least) space you can order them by size like this (the -h
switch does the magic of understanding humanized size formats):
du -h --max-depth=1 . | sort -h
40K ./a
3.1M ./c
500M ./d
2.3G ./b
2.8G .
Note that you will need to wait for du
to compute its whole output which then gets piped into sort
.
Posted by Arne Hartherz to makandra dev (2011-06-08 08:24)