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.
> ping 192.168.0.1 numeric count 1 ..1 PING 192.168.0.1 (192.168.0.1): 56 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 packets received, 0.0% packet loss round-trip min/avg/max = 1.329/1.329/1.329 ms > ..2 > ping 192.168.0.1 numeric count 1 ..3 PING 192.168.0.1 (192.168.0.1): 56 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 packets received, 0.0% packet loss round-trip min/avg/max = 1.225/1.225/1.225 ms > ..4 > ping 192.168.0.2 numeric count 1 ..5 PING 192.168.0.2 (192.168.0.2): 56 data bytes --- 192.168.0.2 PING Statistics --- 1 packets transmitted, 0 packets received, 100.0% packet loss > |
-
Execute the ping command on 192.168.0.1.
-
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.
-
Execute the ping command on 192.168.0.1.
-
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.
-
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.
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 (zueng010.tif, zueng011.tif, <-, ->) might not call a command. If so, check the settings in your communication software manual.