Launch Terminal by moving to the Applications folder in the Finder, opening up Utilities, and then double-clicking on the Terminal application, as shown in Figure 1-2. It starts up and you have a dull, uninspiring, white window with black text that says "Welcome to Darwin!", and a shell prompt.
Figure 1-2. Finding Terminal in the Utilities folder
1.2.1 Changing Terminal Preferences
To change the Terminal's preferences, go to Terminal Window Settings . . . . You see a display similar to Figure 1-3.
Figure 1-3. Shell settings
At the top of the window, notice that a drop-down list lets you select which options to configure: Shell, Processes, Emulation, Buffer, Display, Color , Window, and Keyboard. The names suggest what each does, but let's have a closer look anyway, particularly since some of these settings definitely should be changed in our view.
When you first open the Terminal Inspector, the Shell settings are displayed, as shown in Figure 1-3. This panel specifies which tty (virtual Terminal device) and shell are associated with the current Terminal window. In addition, it allows you to choose one of the following options: when a login shell exits, the Terminal application can close the window; close the window only if the shell exited cleanly (that is, returned a zero status code, which means that all the applications gracefully shut down); or never close the window. If you like to study what you've done and want to be forced to explicitly close the Terminal window, "Don't close the window" is for you. Otherwise, either of the other two will work fine.
If you want to change the login shell for future Terminal windows, open up the Terminal Preferences dialog box, as shown in Figure 1-4.
Figure 1-4. Terminal Preferences
Almost all users will leave these preferences alone. The most interesting of them is the option of opening a saved . term file: we'll talk about .term files later in this chapter in Section 1.3.5.
One of the more subtle capabilities of the Terminal application is that it can keep track of what applications you're running so it can be smart about confirming window close requests : if there's something still running in the window, a dialog box pops up asking if you're sure you want to quit. This feature is very helpful if you are prone to accidentally clicking the wrong window element or pushing the wrong key sequence.
The Processes window shown in Figure 1-5 lists all the processes running under the Terminal window and lets you specify what to do when you close a window. Set "Prompt before closing window" to "Always" if you'd like Terminal to always ask before closing the window, or set it to "Never" to prevent it from ever asking. You can also use "If there are processes other than" setting (the default) to ignore the programs shown in the list (you can add or remove items from this list).
Figure 1-5. Processes
These preferences, shown in Figure 1-6, don't need to be altered by most users.
Figure 1-6. Emulation
It's best to leave "Paste newlines as carriage returns" so that you can ignore the difference in end-of-line sequences in Mac files versus Unix files, and to avoid strict "VT-100" emulation because it can get in the way of some of the newer Mac OS X Unix utilities. Whether you enable "Option click to position cursor" might depend on whether you're a Unix purist (for whom the "good old keyboard" works fine) or whether you're trying to simplify things. Beware that if you do enable Option-click positioning, it won't work in all cases ” only when you're in a full-screen application such as Emacs or vi.
The settings in this area probably don't need changing, as shown in Figure 1-7. The scrollback buffer allows you to scroll back and review earlier commands and command output. The default value of 10,000 lines should be more than enough for most people. If you want to use less memory, you can put in a smaller number or completely disable the scrollback buffer, rather than specify a size.
Figure 1-7. Buffer settings
You can also choose whether the Terminal should wrap long lines (not all Unix programs will wrap long lines, and might disappear off the edge of the window if this option isn't set), or whether you should automatically jump to the bottom of the scroll buffer upon input (if you've scrolled back to examine something that transpired earlier in your session). These options are set by default, and you should probably leave them that way.
One area that you'll probably fine-tune more than others is Display, as shown in Figure 1-8. Here you can specify a different (or larger) font, define the shape of your cursor within the Terminal window, and control character set encoding.
Figure 1-8. Display settings
While you can choose any font available on your system, you'll find that your display will end up quite wonky and unreadable if you don't stick with monospace or fixed-width typefaces . Monaco is a good choice, and is the default typeface for the Terminal application.
Finally, you can specify a nonstandard string encoding if you're working with an unusual language or font. The default UTF-8 (Unicode 8-bit) encoding will work in most situations.
The Color settings let you change the normal text, background, bold text, cursor, and selection colors, as well set the transparency of your Terminal window. The default color settings display black text on a white background, but we find that light text on a dark background is easier to read for extended periods. One suggested setting is to have the background very dark blue, the cursor yellow, normal text light yellow, bold text light green, and the selection dark green. The default color scheme is black text on a white background, as shown in Figure 1-9.
Figure 1-9. Color settings
It's worth experimenting with the different predefined color settings. We particularly like green on black and white on blue, but your tastes will undoubtedly vary!
If you have a large display or are running at a higher resolution than 800 x 600, you'll find it quite helpful to enlarge the Terminal window to offer a bigger space within which to work. The default is 80 characters wide by 24 lines tall, as shown in Figure 1-10.
Figure 1-10. Window preferences
The title of each Terminal window can be fine- tuned as well. You might find the device name (what you'd get if you typed tty at the shell prompt), the window dimensions, and the Command Key option (this shows you which command sequence lets you jump directly to that Terminal window from any other Terminal window you might be using) all particularly helpful.
The final Terminal Inspector pane is the Keyboard pane (see Figure 1-11), which offers much control over which key performs which function within the Unix environment. However, switching something without knowing how it's used can be quite problematic , so we recommend that you do not change any of these settings unless you know exactly what you're doing.
Figure 1-11. Keyboard preferences