1.2 Launching Terminal


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
figs/lux3_0102.gif

By default, Terminal uses bash as its shell. If you'd like to configure it to use a different shell, you can do so by selecting Terminal Preferences and specifying the shell to use. We talk about that later in this chapter in Section 1.2.1.1.


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
figs/lux3_0103.gif

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.

Any changes you make within the Terminal Inspector will affect only the current Terminal window unless you click "Use Settings as Defaults," after which they will apply to all future Terminal windows that you open .


1.2.1.1 Shell

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
figs/lux3_0104.gif

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.

1.2.1.2 Processes

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
figs/lux3_0105.gif
1.2.1.3 Emulation

These preferences, shown in Figure 1-6, don't need to be altered by most users.

Figure 1-6. Emulation
figs/lux3_0106.gif

Some PowerBook G4s have a long delay before emitting audio. If you have one of these and you feel it's a problem, deselect "Audible bell" to neatly sidestep the issue. This also has a nice side effect of preventing people around you knowing when you've made a mistake.


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.

1.2.1.4 Buffer

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
figs/lux3_0107.gif

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.

1.2.1.5 Display

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
figs/lux3_0108.gif

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.

1.2.1.6 Color

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
figs/lux3_0109.gif

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!

1.2.1.7 Window

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
figs/lux3_0110.gif

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.

If you want to change the Terminal window title at any point, you can use the Set Title option either by choosing it from the File menu or by typing figs/command.gif -Shift-T.


1.2.1.8 Keyboard

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
figs/lux3_0111.gif


Learning Unix for Mac OS X Panther
Learning Unix for Mac OS X Panther
ISBN: 0596006179
EAN: 2147483647
Year: 2003
Pages: 88

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net