What are useful Command-line Commands on Mac OS X?

say "some text"

Famously used for getting people back into their apartments, say takes your arguments and reads them aloud through the audio output device.


pbpaste and pbcopy to interact with the pasteboard (aka clipboard).

Examples:

# copies the directory listing
ls -l | pbcopy

# get pasteboard lines containing foo and save them in a_file
pbpaste | grep foo > a_file

I think they default to using the macroman encoding, so if you want UTF-8 (which you do) you should check out these links:

  • http://sigpipe.macromates.com/2005/10/11/clipboard-access-from-shell-utf-8/
  • http://www.macosxhints.com/article.php?story=20081231012753422&query=pbpaste

fs_usage

Lets you monitor file system activity. Handy if you want to see what files some app creates. See http://rentzsch.com/macosx/fs_usageIntro for more explanation.