The UNIX environment has two common commands for looking at disk usage - 'df' and 'du'. 'df' returns information about all mounted disks, and 'du' returns information about a given file or set of files. As installed in OS X, though, the 'df' and 'du' commands do not return easy to use information. For example, here's the 'df' output for one drive on my system:
Filesystem 1k-blocks Used Available Use% Mounted onWouldn't it be much nicer if you could have it output like this:
/dev/disk0s9 3121344 1314624 1806720 42% /osxfiles
Filesystem Size Used Avail Use% Mounted onRead the rest of this article if you'd like to learn how to create a more usable "df" (and other!) commands.
/dev/disk0s9 3.0G 1.3G 1.7G 42% /osxfiles
I'd seen references to a "human readable" version of 'df' in various places, but the command ('df -h') failed on OS X - the '-h' option is not known. So last night I went out to the GNU website, and took a look at their page of available software. One of the packages listed is 'fileutils,' which includes a number of file utilities, including versions of 'df', 'du', and 'ls' with the color option. GNU has a page that describes each program in the package, along with a full set of instructions in just about any format you might want. So I downloaded version 4.0 of the package (GNU's web site has a list of other mirrors) and set out to install it. This was my first-ever attempt at a compile and install under OS X, so I wasn't sure what was going to happen.
NOTE: The following instructions assume you have the developer's tools for the PB, which are available on Apple's Developer website (you have to register for a free online membership). I make no claim that the following steps are safe for your system; I am a complete novice at UNIX compilation, so I may have done some things incorrectly (please, osxhints UNIX experts, correct me if you see mistakes!). Use at your own risk...that said, my machine still seems stable and usable :-).
The basic installation was fairly straightforward. Download the package and expand it, and you'll wind up with a directory named fileutils-4.0. Here's what you do next.
cd /path/to/fileutils-4.0
./configureThis runs a script which attempts to set the proper variables for a proper compile on your system. It takes a while (five minutes?) to run.
make
make installEnd your root session by typing 'exit'
setenv MANPATH /usr/local/man:/usr/share/man:$MANPATHThis inserts our new local man pages ahead of the existing path, so when you type 'man ls', you'll get the man pages for the new command instead of the old. To use any of the old commands, you'll need to put their path in front of them, like this: /bin/ls, /bin/df, etc.
Mac OS X Hints
http://hints.macworld.com/article.php?story=20010309090441378