XG Series User's Guide
Chapter 2 Using the CLI
Using the CLI
49
Re-executing commands
You can enter a history specifier at the beginning of the command string to re-execute the command. The command will be
executed after the command string for re-execution is displayed. In addition, command history and history numbers can be
viewed with the history command. Note that you can enter the history specifier only once at the beginning of the command
line. Any history specifiers entered thereafter will be treated as normal characters.
When you enter a string following the history specifier, it will be added to end of the command string invoked from the
history.
The following shows an example.
z
Command
Redisplaying commands
You can redisplay a previously run command by entering a display specifier (:p) following a history specifier. Note that the
displayed command is not re-executed yet.
Since the displayed command string is recorded as a new command history item, you can re-execute it by entering !! after
checking the command string.
When you enter a string following the display specifier, it will be added to end of the command string invoked from the
history.
A command execution example is shown below.
z
Command
History specifier
Operation
!!
Re-execute the last command run.
! history number
Re-execute the command with the specified history number.
!-number in history
Re-execute the command run the specified number of commands before in the history.
Ex.) !-3 (The third command from the newest in the history is re-executed.)
! string
The last run command beginning with the specified string is re-executed.
Ex.) !net (The last run command beginning with "net" is re-executed.)
# show ip route
(The execution results of show ip route are displayed.)
#
!!
all
(Add "all" to the last command and execute it.)
show ip route all
(Display the command string to re-execute.)
(The execution results of show ip route all are displayed.)
Display specifier
Operation
:p
Redisplays a command.
Ex.) !net:p (The last run command beginning with "net" is redisplayed.)
# show ip route
(The execution results of show ip route are displayed.)
# !!:p all
(Add "all" to the last command executed and display it.)
show ip route al
(Display the command string.)
# !!
(Re-execute the previous command.)
show ip route all
(Display the command string to re-execute.)
(The execution results of show ip route all are displayed.)