Finding large directories through the command line

A quick way of showing which directories are taking up how much space on unix systems.

Starting at the root, use du to show disk usage.

cd /
du -h --max-depth=1

-h makes the output human-readable, and -max-depth=1 stops du form descending into subdirectories.

You should get output that looks something like this:

6.2M    ./sbin
8.0K    ./home
232M    ./opt
4.0K    ./boot
4.0K    ./mnt
5.2M    ./bin
8.0G    ./var
0   ./sys
4.0K    ./media
80M ./root
6.7M    ./tmp
1.3G    ./usr
120K    ./build
4.0K    ./srv
12K ./dev
8.9M    ./etc

var and to a lesser extent usr are hogging disk space. Then just cd into var and run du -h --max-depth=1 again to see which subdirectories are largest. Repeat.