There’s a neat command on Macs (and Linux) named ‘du’ which according to the man page (man du) stands for disk usage. Obviously, I’m talking Terminal here, specifically Terminal.app (which in actuality, is not really a file at all, but a folder containing many files which OS X treats as a single file application in the GUI, and if you don’t believe me, drop to Terminal [thought and almost typed DOS] and run “ls -alR /Applications/Utilities/Terminal.app | more” which will show you all the files in the application, allowing you to spacebar between screens of information). OK, enough chasing the rabbit. The du command I used specifically (in my home folder, which shows as a tilde “~” in the graphic) was this:
du -ch -d 1 | grep [GM]
Breaking it down, this means (note the special guest appearance of grep):
“du” means disk usage (easy enough, right?).
“-ch” is actually two options I’ve combined for convenience. “c” means show a total (c)ount at the end, and “h” means human readable (always a plus, unless you’re a computer yourself).
“-d 1” is an option with a parameter. It means folder depth, with the parameter meaning to go only one-level deep in your folder tree.
“|” is the pipe command. I won’t explain that here, except to point out that it takes all the output du generates and sends (pipes) it to the grep utility (for text extraction).
“grep” is a handy-dandy text extractor. I barely know how to use it. So that’s all I’ll say about that.
“[GM]” is the parameter for grep, meaning, blaze through all the data you just got and really just show me the lines with an UPPERCASE “G” (for gigabyte) or “M” (for megabyte). I used these because they make sense in the context of du (and then only with the “-h” option). But keep in mind that grep neither knows nor cares where it gets its input from; its sole concern is to extract whatever text it’s told to.
Basically, what we just did is told OS X to show us what’s in my home folder and show me only the big, important stuff (megabytes, and gigabytes, and I’ll never have terabytes on this machine unless I buy a MUCH larger hard drive).
Well, have fun. Remember, if it goes up in smoke, down in flames, or blows up, I don’t care. So be sure you did your backups first, and don’t tell me how it works out, unless you like it (or have constructive criticism).
P.S. For more information, check out a man page for du.
P.P.S. No, I don’t use a 37 x 12 Terminal window in real life. That was just for this post. 🙂