Steve Levine

Directory size from the cmd line

Have you ever wanted to scan recursively through a directory to find out how much space each sub directory was taking up? Well, there is an easy way of doing this on *nix. Just run du “Disk Usage”.

On a Darwin (OS X) based distro you can run:
du -hd1
which tells du to render the results in [h]uman readable format and to traverse a max depth of 1.

To achieve the same results on a Linux based distro you can run
du -h --max-depth=1

For further information (rtfm) refer to the man page.

Related Posts

This entry was posted by Steve on Saturday, February 25th, 2006 at 8:55 pmand is filed under: , , .

Fork me on GitHub