beautypg.com

Command-line editing – HP NonStop G-Series User Manual

Page 41

background image

reexecute them. This feature may save you time because it allows you to reuse long commands
instead of reentering them.

To view the contents of the history buffer, use the history command. The displayed output will
be similar to the following (your output will vary):

[18] $ history

3 ls -l
4 pwd
5 cd /usr/sales
6 ls -l
7 cp report report5
8 mv /usr/accounts/new .
9 cd /usr/accounts/new
10 mkdir june
11 cd june
12 mv /usr/accounts/new/june .
13 ls -l
14 cd /usr/sales/Q1
15 vi earnings
16 cd /usr/chang
17 vi status

[19] $

To reexecute any command in the command history buffer, use the commands listed in

Table 7

.

Note that each command starts with the letter r.

Table 7 Reexecuting Commands in the OSS Shell History Buffer

Description

Command

Reexecutes the previous command.

r

Reexecutes the command specified by n. For example, using the history buffer shown in
the previous display, r 5 reexecutes command number 5, cd /usr/sales.

r n

Reexecutes a previous command relative to the current command. For example, using
the history buffer shown in the previous display, r -2 invokes command number 16,
cd /usr/chang

.

r -n

Reexecutes the most recent command that begins with characters matching those specified
by string. For example, using the history buffer shown in the previous display, r cp
invokes command number 7, cp report report5.

r string

For more information on reexecuting history buffer commands, see the sh(1) reference page
either online or in the Open System Services Shell and Utilities Reference Manual.

If you want to increase or decrease the number of commands stored in your history buffer, set the
HISTSIZE

variable in your .profile file. This variable has the following format:

HISTSIZE=n

The n entry specifies the number of command lines you wish to store in the history buffer. For
example, to store 15 commands in the history buffer, use the following command:

HISTSIZE=15

Command-Line Editing

The shell allows you to list and edit the command lines in your command history buffer. You can
modify any element of a previous command line and then reexecute the command line.

The command-line editing functions are extensive. This subsection discusses only the most basic
functions. For more detailed information, see the sh(1) reference page either online or in the
Open System Services Shell and Utilities Reference Manual.

Command-Line Editing

41

This manual is related to the following products: