hoopajoo.net
Pruning folders
Pruning folders
⇐ Back to Administration

Questions, comments, or corrections? Send me a message.

Many times you start to run out of disk space and you're not always sure where it's going. The easiest way to find the places using to most space is with a combination of du and sort. For example, say you're disk is getting full and you suspect someone may be hoarding mp3's or large tar.gz files in their home directory. You could find any abusers this way:

du /home | sort -n
This will output a list of directory sizes with the largest directory at the bottom. Here's a sample output:
4	./ftp/incoming
4	./ftp/lib
4	./ftp/pub
4	./ftp/usr/bin
4	./psocccer/.ddd/sessions
4	./psocccer/.ddd/themes
4	./psocccer/.enlightenment/themes
4	./psocccer/.gedit
4	./psocccer/.gimp/brushes

...

34580	./psocccer/anime
96572	./psocccer/office52/share
132784	./psocccer/office52/program
256920	./psocccer/office52
502008	./psocccer
502192	.
The number on the left is the number of K used in that directory and all it's sub directories. You can see psocccer (me) has 250 megs in a directory called office52. That at least gives you a good place to start when pruning. That final '.' is the total space of the whole /home directory, or whatever directory you specified.

An alternate way to look at it suggested by thehaas@binary.net is:
du /home | sort -nr | less
Which would put the larger stuff on top and let you page through the mess.

Other useful places to look to reclaim space are /var, /tmp, and sometimes /usr/local even.