25 Top OS X Terminal Tips
Posted 06/25/2010 at 10:53am
| by Ian Osborne

Get extra mileage from your Mac using OS X's Terminal.
Terminal (in Applications/Utilities) gives you direct access to the UNIX system that underpins Mac OS X. By typing specific commands into your Terminal window, you can make changes, open settings, or access features that aren’t available by any other means.
After typing one of the commands listed here, press Return to activate it. Commands split over two or more lines should be typed in their entirety--don’t press Return halfway through. And bear in mind that some commands are case-sensitive, so be true to exactly what’s printed here. One final warning: All the tips in this feature have been thoroughly tested, but experimenting with the Terminal is not a task to be undertaken lightly. Don’t try to modify or adapt these commands unless you really know what you’re doing.
1. iRobot
Your Mac can talk to you. Using a robotic voice reminiscent of a 1950s sci-fi flick, it can ask after your health, tell you a joke, or say anything else you care to type. It’s a simple trick. Just open the Terminal application and enter: say Mac Life
And the Terminal robot utters the name of this magazine. Obviously it doesn’t have to be Mac|Life--type anything you like. Give it a go; it’s fun.
2. Back Up at Will
By default, Time Machine backups take place every hour, but you can change this through the Terminal. To make it back up every half hour instead, simply type: sudo defaults write /System/Library/LaunchDaemons/com.apple.backupd-auto StartInterval -int 1800
The 1800 at the end of this command is a half hour, expressed in seconds. You can change this figure to suit: For example, to back up once an hour again, replace it with 3600, and for two-hour backups, use 7200. Always remember to be especially careful with commands that begin with “sudo.” These are system-level commands that can cause huge problems if misused, which is why you’re asked for your administrator’s password the first time you try one.
3. Login Greetings
Another sudo (and therefore dangerous) command enables you to add a message to the login window. In the Terminal, type: sudo defaults write /Library/Preferences/com.apple.loginwindow LoginwindowText “Your Message”
Replace Your Message with whatever it is you want to display, of course, but leave the quotation marks around it intact, and be careful with your punctuation. Some characters (exclamation points, for instance) stop the command from working.
To remove the message, type: sudo defaults write /Library/Preferences/com.apple.loginwindow LoginwindowText “”
4. Play Games in the Terminal

A variety of simple games--like Pong--are accessible via the Terminal.
As you may know, OS X is UNIX-based. Emacs, a text editor, forms part of the UNIX system, and it contains some Easter egg games, including the ever-popular Tetris, Pong, and Snake. First you must find your Emacs version number. In the Terminal, type: cd /usr/share/emacs/
Press Return. Now type ls (lowercase LS) and press Return again. You’re given your Emacs version number (1.21, for instance). Write it down. Then enter the following: ls /usr/share/emacs/[VERSION]/lisp/play
Replace [VERSION] with the number obtained earlier (no parentheses). You get a directory of all the available games. Make a note, or take a screenshot. Now switch to Emacs through Terminal by simply typing emacs. To access the games, press Escape, then X, and type the name of the game you want to play before pressing Return. You can switch to the next game by pressing Escape, X, and the name of the next game. Have fun!
5. Fix Window Sizes in FFView
A. Resize Problem

FFView (www.feedface.com/projects/ffview.html) is a great sequential image viewer, perfect for comics, but its Pagewidth Mode resizes its window every time you turn to the next image. This is very annoying if you want to set--and stick to--your own window size.
B. Resize Resolution

Terminal solves the problem. Type: defaults write com.feedface.ffview udn_dont_resize_img_win 1
The window now remains a constant size. To reverse this, enter the code again, replacing the 1 at the end with 0. Now restart the app.
C. Want Comics?

There’s a wealth of downloadable free comics available on the web. For example, mobile comic publisher Robot Comics offers a list of high-quality, free-to-download material suitable for reading on your Mac with FFView. Check it out at http://tinyurl.com/dk8ell.
6. Get a Massive Dock

If you want giant-sized magnified Dock icons, enable Magnification in System Preferences > Dock, and in the Terminal type: defaults write com.apple.dock largesize -int 512; killall Dock
This increases their maximum size to 512x512 pixels. You can substitute another figure if you wish, but don’t go any higher than 512. To switch this effect off, just return to the Dock’s preferences and move the Magnification slider back.
Next: Terminal Tips Continued >>