I'll have to hunt for links, but i know we've covered this ground (in detail) at MFI twice before:
- Re: what has happened to my diskspace? [June 24, 2006]
- Re: Missing HardDisk space [April 03, 2007]
The
real problem with sudo du -sh /* is that the asterisk won't match items starting with a dot (or period). So stuff inside of
/.Spotlight-V100
/.TemporaryItems
/.Trashes
/.fseventsd
/.vol
will never get measured.
And neither will any
other slashdot folder (i.e., in / whose name starts with a . ) which might happen to exist.
The -d option determines the depth to which the folder hierarchy is traversed, so when its value is 0, no subdirectories are traversed. I don't know how to make the command recursive, but I'm sure someone will.
In effect, du is already recursive... and in fact, there's no option to prevent that.
-d is merely determining how deep the *
displayed* results will drill.
The typical (macosxhints crowd) command is this:
sudo du -d 1 -h -x /
That's the "straight-laced" Unix way (separated options), which a more liberal user might enter as:
sudo du -hxd1 /
Try out these two and you'll see the
same total... but a different display depth:
du -hd1 ~/Desktop
du -hd2 ~/Desktop
Edit: added
-x just know that the -x option is handy when measuring / to prevent
du from venturing below /Volumes.
I.e., when measuring /, we usually don't intend to delve down into mounted disks or networked shares.
If that _is_ what's wanted, then remove the
x --
As far as the two Desktop examples go, if you're one of those people who keep
zero items on the desktop, then those two examples will fail to impress. If such is the case, then try the docs folder instead:
du -hd1 ~/Documents
du -hd2 ~/Documents