Skip to Content
Mac OS X in a Nutshell
book

Mac OS X in a Nutshell

by Jason McIntosh, Chuck Toporek, Chris Stone
January 2003
Intermediate to advanced
832 pages
32h 40m
English
O'Reilly Media, Inc.
Content preview from Mac OS X in a Nutshell

Command History

Previously executed commands are stored in a history list. tcsh lets you access this list so you can verify commands, repeat them, or execute modified versions of them. The history built-in command displays the history list; the predefined variables histchars and history also affect the history mechanism. There are four ways to use the history list:

  • Rerun a previous command.

  • Make command substitutions.

  • Make argument substitutions (replace specific words in a command).

  • Extract or replace parts of a command or word.

The following subsections describe the csh tools for editing and rerunning commands. If you are running tcsh, you can use any of these features. In addition, you can use the arrow keys to move around in the command line and then use the editing features described later in Section 21.7.4 to modify the command. The tcsh arrow keys are described in the following table:

Key

Description

Up Arrow

Previous command.

Down Arrow

Next command.

Left Arrow

Move left in command line.

Right Arrow

Move right in command line.

Command Substitution

Command

Description

!

Begin a history substitution.

!!

Previous command.

! N

Command number N in history list.

!- N

Nth command back from current command.

! string

Most recent command that starts with string.

!? string?

Most recent command that contains string.

!? string?%

Most recent command argument that contains string.

!$

Last argument of previous command.

!! string

Previous command, ...

Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

Mac OS X Internals: A Systems Approach

Mac OS X Internals: A Systems Approach

Amit Singh
C++ In a Nutshell

C++ In a Nutshell

Ray Lischner
Linux Shell Scripting Cookbook - Third Edition

Linux Shell Scripting Cookbook - Third Edition

Clif Flynt, Sarath Lakshman, Shantanu Tushar
Optimized C++

Optimized C++

Kurt Guntheroth

Publisher Resources

ISBN: 0596003706Supplemental ContentCatalog PageErrata