25 Terminal Tips Every Mac User Should Know
Posted 12/11/2008 at 11:40am
| by Johnathon Williams
From customizing your Mac’s secret system preferences to remotely controlling another Mac or manipulating text files in a handful of sly ways, the terminal utility is more than just a Mac geek’s home base. It’s a place where, with a few expert tricks, all Mac users can feel right at home.
If there’s a more neglected or misunderstood Mac utility than the Terminal, OS X’s built-in command-line app, we’ve yet to find it. In an age where Apple’s $200 smart phone offers the most intuitive graphical user interface the world has ever seen, turning to a text-only command-line window can seem stubbornly retro, reminding us of audiophiles who vociferously insist that vinyl records sound better than music CDs. But there are plenty of reasons for using the command line beyond mere nostalgia: speed, flexibility, and familiarity with OS fundamentals, to name a few. We’ve collected 25 Terminal-based solutions for common desktop issues, because knowing these tricks is an invaluable addition to any Mac user’s toolbox. And while there is no reason to abandon the Finder, think of mastering the Terminal as learning to drive a car with a manual transmission—once you can drive a stick, you can drive anything.
The first thing to know about the Terminal is how to launch it, which you do by
going to \Applications\Utilities\Terminal. Also, you’re no longer in graphical user-interface land: Most of what you’ll do in the Terminal is enter specific text strings, then press Return to execute them. When you see generic references like name-of-file or path-to-file throughout this article, replace that text with your file name or path.
1. Handy Terminal Pointers
> Only text commands are accepted--you won’t use your mouse much within the terminal, with a few exceptions.
> Execute commands by pressing Return.
> Every keystroke matters, including spaces and special symbols.
> Interrupt any running command by pressing Control-Z.
> Recall previously entered commands without retyping them by pressing the up arrow.
> Curious about a new command? Type man name-of-the-command, then press Return to read its instruction manual. For instance, man SSH will produce the manual for SSH.
> For a list of all commands available in the Terminal, hold down Escape, then press Y when prompted.
> Page down through multipage results by pressing the space bar.
> For commands that require the path to a file or folder, save yourself some typing by dragging and dropping the file or folder at the end of the command. The Terminal will automatically copy the dropped item’s path and name.
2. Know Your Way Around
By default, the Terminal targets your Home directory (folders are called directories in Terminal-speak). You can move to different directories by executing the command cd path-to-directory. If you get lost, type cd ~ to return to your Home directory. View a list of all files in the Terminal’s current directory by executing ls.
3. Anatomy Of A Terminal Command

Unlike the sentences you were forced to diagram in sophomore English, Terminal commands only have three parts: the command, which calls a specific command-line utility; the options, which modify the command’s output; and the argument, which is typically the website, file, or other resource that the command will be operating on.
4. Get Comfortable in Your Shell
The Terminal app is Apple’s implementation of a traditional Unix command-line environment, also called a shell. Keep in mind, though, that Unix shells come in many different flavors. OS 10.5 (Leopard), for instance, uses the Bash shell by default. If this article inspires you to Google even more command-line tricks, remember that some command-line utilities are shell-specific, meaning that what works in Tcsh on that helpful blogger’s Linux box might not work in Bash on your Mac.

When it comes to customizing the look and feel of your Mac, the options listed in System Preferences only scratch the surface. Hiding throughout the OS are dozens of hidden preferences that can only be changed through the defaults command. Too many exist to list them all here, so we’ve compiled our five favorites. Always remember to quit an application before modifying its defaults. You can reset any of these commands by replacing TRUE with FALSE and executing it again.
5. Make All Links In Safari Open As New Tabs

New windows, baaad. New tabs, gooood.
In general, Safari’s tab controls are wonderful, but one failing drives us crazy: Certain links are allowed to override your preference for opening new webpages in tabs, essentially forcing the application to open a new window. To prevent this in the future, execute this command: defaults write com.apple.Safari TargetedClicksCreateTabs -bool TRUE.
6. Force Mail To Display All Messages As Plain Text

Even those annoying bank statements appear in plain text, thanks to the magic of defaults.
Few things are more irritating than that office mate who just discovered how to make colored fonts and add funny graphics in his email program. With the exception of Mail’s attractive New Message templates, most heavily formatted messages are spam anyway, so make things easier on your eyes by forcing all messages to display as plain text by executing this command: defaults write com.apple.mail PreferPlainText -bool TRUE.
7. Show Hidden Files in The Finder

The names of hidden files always begin with a period--keep that in mind before you delete or edit a file that doesn’t look familiar.
Believe it or not, the files you see listed on your Desktop in the Finder do not represent all of the files contained in your Desktop folder. In almost every folder, the OS hides system files that Apple considers too important for the likes of us to mess with (or too mundane for us to be bothered with). Now and again, though, it’s useful to view these files. To see the full contents of all folders in the Finder, execute defaults write com.apple.finder AppleShowAllFiles TRUE.
8. Change The File Format For Screenshots

PNG, or portable network graphics, is a file format that offers high image quality and small file sizes, but may not be opened by all image-editing software.
OS 10.5 saves screen captures as PNG files by default, but it can save them in a variety of formats, including PDF, JPG, and GIF, to name a few. Switch to your preferred format by executing defaults write com.apple.screencapture type file-extension, replacing file-extension with the three-letter abbreviation for your chosen format. For instance, to change the default format to PDF, you’d execute defaults write com.apple.screencapture type PDF.
9. Disable the Dashboard

When the Dashboard appears on our Desktop, it’s usually because we missed the delete key and hit F12 instead.
We’ve always liked the Dashboard in theory--on occasion, we’ve even downloaded widgets for it. Unfortunately, we never get around to using them, and our aging Mac laptop could use the extra RAM to run real apps. If you’re in the same boat, free up some system memory by terminating the Dashboard with two quick Terminal commands. First, set its default to Off by executing defaults write com.apple.dashboard mcx-disabled -boolean YES. Second, kill and restart the Dashboard and Dock with this command: killall Dock.
Next Mac Security Terminal Style