Chapter 4. Mac OS X Unix Basics

This part is a basic introduction to show new users the Unix side of Mac OS X. Specifically, this section will cover:

  • Configuring and using the Terminal

  • Command-line editing with tcsh

  • Additional shell commands, such as bindkey, defaults, and open

  • Basic Unix commands

You don’t have to venture into the command line if you don’t want to, but it’s easy to be seduced by its power, as this part shows you a glimpse at what’s possible with just a few easy keystrokes.

Configuring and Using the Terminal

The Terminal application (/Applications/Utilities) is your interface to Mac OS X’s Unix shell. The Terminal can be used for everything from creating new directories (folders) and files to launching applications, and from managing and monitoring your system to programming and tweaking your system preferences.

Terminal Settings

This section offers advice on how to configure the settings for your Terminal. Previously, you would use Terminal Preferences to configure the Terminal’s settings. However, with Jaguar, you’ll need to use File Show Info and change the settings from the Terminal Inspector window via the pull-down menu at the top of the window.

Change the style of the cursor?

Display & Cursor Style (Block, Underline, Vertical Bar).

Stop the cursor from blinking?

Display Cursor Style Deselect Blinking Cursor.

Change the background color and font colors of the Terminal window?

Color click on the color selection boxes next to Background, Cursor, Normal Text, Bold Text, and Selection to open another window with the color wheel, which allows you to change and select a different color and even the transparency of the Terminal window.

Assign a different title to the Terminal window?

Window Title.

Assign a different title to the current Terminal window?

With an open Terminal window, select File Set Title (Shift-

Terminal Settings

-T). The Terminal Inspector window will open with Window selected in the pull-down menu. Enter a new title for the window in the Title field and hit Return or Tab to change the title of the current window.

Specify the number of lines a Terminal window can contain in the scrollback buffer?

Buffer Buffer Size. You can either specify a number of lines in the field provided (10,000 lines is the default), or select from an unlimited scrollback or no scrollback at all.

Set the Terminal’s emulation mode to VT100?

Emulation Strict VT-100 keypad behavior.

Close the Terminal window after I’ve exited?

Shell When the shell exits (select from either “Close the window” or “Close only if the shell exited cleanly”).

Where is the history file for the shell?

It’s located in your home directory as .tcsh_history. The history file keeps track of recently entered commands, which you can recall in a variety of ways, the easiest of which is to use the Up or Down Arrows to go back or forward in the history file, respectively.

Where is the shell’s configuration file located?

In /usr/share/tcsh/examples/rc.

Can I create a customized shell environment that’s different from the one used by other users on the system?

Yes, but read and follow the instructions in the README file located in /usr/share/tcsh/examples.

Keyboard Shortcuts

Table 4-1 lists the keyboard shortcuts that can be used with the Terminal application.

Table 4-1. Keyboard shortcuts for use with the Terminal

Key command

Description

Keyboard shortcuts for use with the Terminal

-. (period)

Terminate process (same as Control-C, the Unix interrupt command)

Keyboard shortcuts for use with the Terminal

-Up Arrow

Scrolls up one line at a time

Keyboard shortcuts for use with the Terminal

-Down Arrow

Scroll down one line at a time

Keyboard shortcuts for use with the Terminal

-Left Arrow

Go to previous Terminal window

Keyboard shortcuts for use with the Terminal

-Right Arrow

Go to next Terminal window

FN-Up Arrow

Scroll up one screen at a time

FN-Down Arrow

Scroll down one screen at a time

FN-Left Arrow

Scroll backward to the top of the screen

FN-Right Arrow

Scroll forward to the bottom of the screen

Keyboard shortcuts for use with the Terminal

-A

Select all the text in the Terminal window, including the scrollback

Shift-

Keyboard shortcuts for use with the Terminal

-C

Use to open or close the Colors window

Keyboard shortcuts for use with the Terminal

-I

Open the Terminal Inspector, which allows you to change some of the Terminal’s settings

Keyboard shortcuts for use with the Terminal

-K

Clear all the information from the Terminal window, disabling scrollback (this is different and more extensive than the clear command, described later)

Keyboard shortcuts for use with the Terminal

-N

Open new Terminal window

Shift-

Keyboard shortcuts for use with the Terminal

-N

Run a command in a new Terminal window

Keyboard shortcuts for use with the Terminal

-S

Save the settings of the Terminal window as a .term file

Shift-

Keyboard shortcuts for use with the Terminal

-S

Save the settings of the Terminal window as a differently named .term file

Option-

Keyboard shortcuts for use with the Terminal

-S

Save the contents of the Terminal window, including any scrollback, as a text file

Shift-Option-

Keyboard shortcuts for use with the Terminal

-S

Save any selected text in the Terminal window as a text file

Keyboard shortcuts for use with the Terminal

-T

Open the Font panel so you can change the Terminal’s default font settings, including the font family, size, and color

Keyboard shortcuts for use with the Terminal

-number

Switch to a different Terminal window, based on its number

Get Mac OS X Pocket Guide, Second Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.