If you are just starting to use the UNIX/Linux command line, go read UNIX/Linux tutorial for beginners or even Learn UNIX in 10 Minutes. Natbat's Terminal Reference has prompted me into trying to shove all the various UNIX and OS X brain-worms onto wikipaper.

General principles and why

  1. If it's a repetitive or non-interactive task, do it at the shell rather than using yet another GUI tool for it. It's usually quicker, less error-prone and when it does fail, you'll get a more useful (though less pretty) error message. Examples:
    • File conversions (images, audio etc.). I tend to convert lots of audio and image files into different formats. On the Mac, when I last looked, there was only one tool I found that handled FLAC-to-MP3 conversion. It featured an icon of a gorilla wearing headphones or something. But worse than that, it couldn't do a folder of FLAC files, but only do one at a time. It was completely painful. But if you install flac and lame at the command line, you can do `flac -cd {file}.flac | lame -h - {file}.mp3`.
    • Large files. Sometimes I want to slice a PDF. Not often mind, but sometimes. Ghostscript is my go-to tool for such operations. I've tried Acrobat and other high-end tools. Generally, if you've got a really large file (I've got some PDFs that are hundreds of megabytes), the GUI tool has to load it into memory before you can play with it. If you use `gs`, you can specify what you want and it'll happily churn away in the background, rather than eating up system resources drawing lots of fancy GUI stuff. You can then use the resources you've saved to, oh, play some emulator games.
  2. Scriptability is another reason to use CLI tools. While AppleScript, despite it's abortion of a syntax, lets you automate and script some aspects of Mac GUI applications, it's often much more efficient just to go straight to the real thing.

Quick hit wins

Know thy finding commands

Terminal.app fixes, and why you should learn screen

Audio

tom 52832 2.5 0.2 606708 3496 s001 S+ 10:14pm 0:00.74 mpg321 ...tom 137 0.0 2.8 1083980 58992 ?? S Tue11pm 154:06.93 [...]iTunes

tom 132 0.0 0.1 879128 1692 ?? S Tue11pm 0:01.04 [...]iTunesHelper[...]

Powered by WiGit