Quick Tip: du’s –max-depth to find fat directories
December 24, 2008Sometimes you’re working on your computer and things start to work strange. The softwares starts to crash without reason… uhoh… or my home or my temp/var folders are full.
To quickly have an overview of your directory sizes du helps wonderfully!
du is an utility binary that comes with (I think) most Linux distributions and some BSD that lists all directories’ and subdirectories’ “disk usage” (got it?). By default, du scans recursively until the last directory on tree.
The --max-depth attribute used with the -h (human-readable units) provides a good look at your disks’ size.
The following code scans only your first directories whithin your home directory:
du -h --max-depth=1 ~
Just change the --max-depth value to match your needs.