Getting to the Command Line


The primary way to get to the command line in Mac OS X is with the Terminal application.

Terminal is an Aqua application that allows you to open multiple windows , each of which provides a place to enter commands and see output from those commands.

Because Terminal utilizes the Aqua User Interface of Mac OS X, you can do anything you'd expect from a Mac graphical applicationyou can print, copy text and paste into other windows, and adjust preferences such as color and font size .

Practically all of your command-line work in Mac OS X will be done using Terminal.

To open Terminal:

  • Locate the Terminal application in the Finder by going to the Applications folder and opening the Utilities folder.

  • Double-click the Terminal application icon.

    A Terminal window containing a shell prompt opens ( Figure 2.1 ).

    Figure 2.1. A window opened in the Terminal application.

The shell prompt you see will probably be different from what is displayed in Figure 2.1 because the default prompt contains the hostname (in this case, user-vc8f9gd ) of your machine and your short user name ( vanilla in Figure 2.1). See "Customizing your shell prompt" in Chapter 7, "Configuring Your Environment with Unix," for more on this.

Tips

  • Put the Terminal icon in the Dock. You will be using it often.

  • When adjusting your Terminal preferences (under Window settings in the Terminal menu), always stick with a monospace (also called fixed-width ) font like Monaco (the default) or Courier. Command-line software assumes you are using a monospace font, and proper text layout in Terminal depends on this.

  • Experiment with different colors and font sizes for the text and background in Terminal. For example, we prefer 12-point bright green text on a black background because it looks like the screen on an "old-fashioned" computer terminal.

  • Open more than one Terminal window (by clicking New Shell in the File menu), and give each one a different color scheme as a way to differentiate them. You can have as many Terminal windows open as you like.


Other ways to get to the command line

Using Terminal is by far the most common way to get to the Mac OS X command line, but there are other ways that are useful after you have become proficient in using Unix. One way is to log in directly to the command line instead of going through the Terminal application in Aqua. You must have set the login window to show "Name and password," not to automatically log in as a user, nor to display a list of users. You do this in the System Preferences Accounts pane, in the Login Options dialog. (Note: The Aqua interface will not be available until you log out of the command line.)

To log in to the command line interface:

1.
Enter >console as your user name in the login screen. Leave the Password field empty ( Figure 2.2 ).

Figure 2.2. You can use the name >console to log in to the command line instead of Aqua.


2.
Click Login or press .

This switches you directly to the Darwin layer of Mac OS X. A command-line login prompt appears, in white text on a black background ( Figure 2.3 ).

Figure 2.3. When you click the Login button, you are switched directly to the Darwin layer of Mac OS X and see the Darwin login prompt.


To go back to the Aqua login window, press . Otherwise, proceed to log in to the Darwin layer.

3.
Type your short user name, and press (remember to press after typing each task item). Note: On every other Unix system in the world, this would be called your user name , but Mac OS X uses the concept of short user name to distinguish it from the regular Mac user name.

A command-line password prompt appears.

4.
Type your password at the Password prompt.

Nothing appears on the screen as you type. If you get it wrong, you get another Login prompt, and you are back at the beginning of step 4. If you get it right, the shell prompt appears on your screen.

5.
Type logout to return to the Aqua login screen.

There is a long pause before Aqua starts upas much as a minute. Be patient.

At the time that this book was being written, this method of logging in would not work in Mac OS X 10.4.0 through at least 10.4.2. In fact, it would freeze your machine, requiring you to reboot. We expect that Apple will soon solve the problem. This method does work in Mac OS X 10.3.9.

Another way to get to the command line is to start up the machine in single-user mode . This boots the machine directly into the Darwin layer so that the command line comes up instead of Aqua. You cannot start Aqua from this mode without rebooting. You should only boot to single-user mode if you are extremely comfortable using Unix. See Chapter 11, "Introduction to System Administration," to learn how to boot into single-user mode.



Unix for Mac OS X 10. 4 Tiger. Visual QuickPro Guide
Unix for Mac OS X 10.4 Tiger: Visual QuickPro Guide (2nd Edition)
ISBN: 0321246683
EAN: 2147483647
Year: 2004
Pages: 161
Authors: Matisse Enzer

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