Configuration Guide Vol. 1


5.2.5 History function

The history functionality allows you to easily re-execute a command entered in the past, and to change part of the command before execution. The following figure shows some examples of using the history functionality.

Figure 5-8: Simplified command input using the history facility
> ping 192.168.0.1 numeric count 1                          ..1
PING 192.168.0.1 (192.168.0.1): 56(84) data bytes
64 bytes from 192.168.0.1: icmp_seq=0 ttl=31 time=1.329 ms
 
--- 192.168.0.1 PING Statistics ---
1 packets transmitted, 1 received, 0% packet loss, time 1ms
rtt min/avg/max/mdev = 1.329/1.329/1.329/0.000 ms
>                                                           ..2
> ping 192.168.0.1 numeric count 1                          ..3
PING 192.168.0.1 (192.168.0.1): 56(84) data bytes
64 bytes from 192.168.0.1: icmp_seq=0 ttl=31 time=1.225 ms
 
--- 192.168.0.1 PING Statistics ---
1 packets transmitted, 1 received, 0% packet loss, time 1ms
rtt min/avg/max/mdev = 1.225/1.225/1.225/0.000 ms
>                                                           ..4
> ping 192.168.0.2 numeric count 1                          ..5
PING 192.168.0.2 (192.168.0.2): 56(84) data bytes
 
--- 192.168.0.2 PING Statistics ---
1 packets transmitted, 0 received, 100% packet loss, time 0ms
>
  1. Execute the ping command on 192.168.0.1.

  2. Press the up arrow key (↑) to call the preceding command.

    In this example, pressing the up arrow key once displays the line ping 192.168.0.1 numeric count 1. Simply press Enter to re-execute this command.

  3. Execute the ping command on 192.168.0.1.

  4. Press the up arrow key (↑) to call the preceding command, and then use the left arrow key (<-) and the Backspace key to edit the command string.

    In this example, pressing the up arrow key (↑) once displays the line ping 192.168.0.1 numeric count 1. Change 1 in the IP address to 2, and then press the Enter key.

  5. Execute the ping command on 192.168.0.2.

Using the history functionality and the character strings in the table below, you can call or change a previously executed command string, and then execute the command. Command string conversion is not supported for configuration commands.

Table 5-3: List of characters that can be used for command string conversion in the history

No.

Specification

Description

1

!!

Calls and executes the last executed command.

2

!n

This command is executed after being converted to a command with history number n*.

3

!-n

Calls and executes the nth previous command.

4

!str

Calls and executes the last executed command beginning with the character string str.

5

^str1^str2

Executes the last executed command, replacing str1 with str2.

#

The array number displayed by the show history operation command.

After you call a previously executed command, and then edit the command string or delete the command using the Backspace key or the Ctrl + C keys, you can call the command again and edit or erase its history.

Notes

Depending on the communication software you are using, the arrow keys (↑, ↓, <-, ->) might not call a command. If so, check the settings in your communication software manual.