<<

. 4
( 69 .)



>>




– The Applications folder
¤ Click Go ➪ Applications. ‹ Scroll down until the
LAUNCH THE TERMINAL WINDOW
appears in a Finder window. Utilities icon is visible.
„ On the desktop, click the
› Double-click Utilities.
Finder icon in the Dock.




4
1
GET STARTED WITH UNIX


You can have several Terminal windows running at once. To
open a new Terminal window, press ” + N. To switch
between the Terminal windows, press ” + ← or ” + ’.
If you use the scroll bars to scroll back and then type a
command, the window snaps back to the current prompt,
with the result that you can no longer see the scrolled text.
The version of the Terminal application that comes with
Mac OS X 10.2, Jaguar, lets you split your Terminal window
so that you can keep scrolled text on-screen for reference.
To split the window, click the small icon that looks like a
broken square in the upper-right corner of the Terminal
window. A bar appears, separating the window into two
panes. Each pane has a separate scroll bar, and only the
lower pane scrolls when you type shell commands. You can
change the relative sizes of the panes by clicking the
separator bar and dragging it up or down.
To return the split windows to only one pane, click the
square gray icon in the upper-right corner of the lower pane.




Keep In Dock




– The Utilities folder appears Á Double-click Terminal. ¤ Select Keep In Dock.
KEEP TERMINAL IN DOCK
in a Finder window.
„ Click the Terminal icon in
– The Terminal window – The Terminal icon stays in
ˇ Scroll down until the the Dock and hold for two
opens, displaying a welcome the Dock even after you close
seconds.
Terminal icon is visible. message and a prompt. the Terminal application.
– A pop-up menu appears.


5
UNIX FOR MAC




CONFIGURE THE TERMINAL APPLICATION
seven groups of settings: Shell, Processes, Emulation, Buffer,

Y
ou can set the preferences and settings of the
Display, Color, and Window. You can switch between groups
Terminal application to meet your particular needs.
by selecting the group name at the top of the Terminal
For example, you can give each Terminal a different
Inspector panel. Within each group, you can change a
name, such as Editing the Config File or Compiling the
number of related settings; for example, the Window
Server, to remind you of what you are doing in that
settings allow you to control the size of the Terminal
Terminal; or, if you find the default font size too hard to
window and the title at the top of the Terminal window.
read, you can enlarge it or change it to a different font.
Any changes that you make to the Window settings apply
You can access the Terminal application Preferences panel
only to the current window. However, you can set the
through the Terminal window. This panel allows you to
current values as the default for all future Terminal windows
change the command shell that executes when you start the
by clicking the Use Settings as Defaults button.
Terminal application. For more information on using other
shells, see Chapter 6.
You can save your Window settings by selecting the Save, or
Save As, option from the File menu; this creates a TERM file.
You can change the appearance of the Terminal window by
You can load Window settings from a TERM file by using
selecting the Window Settings option from the Terminal
the Open command from the File menu, thus creating a
menu. The Terminal Inspector panel appears, allowing you
new Terminal window with those settings.
to configure the settings for the current window. There are

CONFIGURE THE TERMINAL APPLICATION
Terminal




Window Settings...




– The Terminal Inspector ˇ Click the Use Settings as
OPEN THE WINDOW SET THE WINDOW TITLE
SETTINGS PANEL panel appears. Defaults button.
¤ Click here to select
„ Click Terminal ➪ Window Á Click the upper-left
Window from the scroll menu.
Settings. button to close the Terminal
‹ Type a title in the Title field. Inspector panel.
› Click additional check
– The title of the current
boxes to add the current
Terminal window changes.
dimensions or process
name to the title.
6
1
GET STARTED WITH UNIX



You can change the color of the Terminal window
The Shell and Processes settings let you
and text by using the Color settings. The Window
determine whether the Terminal window closes
settings affect the dimensions of the window and
when you quit the shell application, and they
the title that appears in the top bar of the Terminal
also help you to avoid accidentally closing
window. You can set the title to a specific name, or
windows with active Unix shell commands
to reflect the current size or running commands of
running. The Emulation settings allow fine-tuning
the Terminal window.
of input and output controls to better emulate,
or mimic, a physical terminal device. The Buffer
settings control the number of lines that the shell
saves as scroll back, and which you can access by
using the scroll bars.
The Display settings control the appearance of
the cursor and the text in the Terminal window.
You can change the font or font size, or you can
set the text to be anti-aliased. Anti-aliasing uses
shades of gray to make the text easier to read,
but it can also slow down the display of Unix
shell commands.




File File




Save As... S




My Terminal Preference.t




– The .term extension ± Click Open.
SAVE THE WINDOW SETTINGS OPEN A TERM FILE
appears as you type.
‡ Click File ➪ Save As. ‚ Click File ➪ Open. – A Terminal window opens
· Click Save to save and with a configuration based on
– The Save panel appears. ” Click a previously saved
close the dialog box. your saved settings.
TERM file.
° Type a filename. – The Window settings are
saved in a TERM file with the
.term extension.

7
UNIX FOR MAC



ENTER UNIX SHELL COMMANDS
mistake: Command not found.

Y
ou can execute Unix shell commands by typing them
directly at the prompt in the Terminal window. These You can recall your last command by pressing the up-arrow
commands allow you to run Unix applications from key; the exact command you typed appears after the
the shell. You can also run commands that tell you the prompt. You can edit the line using the Delete key and then
current state of your shell commands, such as which press Return when you have corrected the mistake. This is
programs are running or the current location of your also a useful way to repeat commands. If you press the up-
Terminal shell in the file folder hierarchy. arrow key repeatedly, you can move either back or forward,
respectively, through all the shell commands you have
After typing each command, you must press the Return key
typed.
to tell the shell that you are done typing. The shell does not
run your command until you press Return. This allows you The easiest Unix command to type is the w command. This
to go back and edit the command before the shell runs it. If command shows you who is connected to your computer
you make a typing mistake, you can use the Delete key to and how long they have been idle. Old Unix machines often
back up and erase your mistake, then retype the command had dozens or even hundreds of users connected at once,
and press Return. but you see only one line for each Terminal window you
have open.
If you do not notice your mistake before pressing Return,
you may get an error message. If you type a non-existent
command, such as mistake, Unix returns the following:


ENTER UNIX SHELL COMMANDS




¤ Type the letter w and press ‹ Type the letter e and press › Type ww and press
ENTER THE W COMMAND
Return. Return. Return.
„ Open the Terminal
– The shell displays the users – An error message appears – An error message appears
application.
connected to your computer. because there is no UNIX because there is no UNIX
shell command named e. shell command named ww.



8
1
GET STARTED WITH UNIX




You enter Unix shell commands through a
TYPE THIS:
keyboard, and so they are susceptible to
typographical errors. Fortunately, you can [darwin:˜] user% ww
set your shell to automatically intercept
these mistakes and to make a reasonable
guess at what you are trying to type. This
helps you to avoid error messages that RESULT:
declare that a command cannot be found.
CORRECT>w (y|n|e|a)? yes
You activate this function by using the 4:16AM up 3:46, 2 users, load averages: 0.78, 0.80, 0.68
set command. To do this, type set correct USER TTY FROM LOGIN@ IDLE WHAT
= cmd after the prompt. user co - 4:01AM 3:45 -
user p1 - 3:53AM 0-
After you have activated the function,
when you enter a command that does not
exist, the shell tries to find a match. It
then asks you to reply by typing a y for
yes, n for no, e for edit, or a for abort.




– The previous command Á Press the Delete key to ‡ Press Return.
CORRECT A SHELL
COMMAND ERROR appears after the prompt. delete the second w.
– The shell executes the w
ˇ Press the Up Arrow key. command.

<<

. 4
( 69 .)



>>