home | O'Reilly's CD bookshelfs | FreeBSD | Linux | Cisco | Cisco Exam  


Linux in a NutshellLinux in a NutshellSearch this book

8.6. Command History

Previously executed commands are stored in a history list. You can access this list to 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 a number of ways to use the history list:

  • Rerun a previous command

  • Edit 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 easiest way to take advantage of the command history is to use the arrow keys to move around in the history, select the command you want, and then rerun it or use the editing features described in Section 8.7.5, later in this chapter, to modify the command. The arrow keys are:

Key

Description

Up arrow

Previous command.

Down arrow

Next command.

Left arrow

Move left in command line.

Right arrow

Move right in command line.

The next sections describe some tools for editing and rerunning commands. With the C shell, which does not have the command-line editing features of tcsh, these tools are important for rerunning commands. With tcsh, they are less often used, but they still work.



Library Navigation Links

Copyright © 2003 O'Reilly & Associates. All rights reserved.