Command Line Interface (CLI) History Expansion

The history expansion character ‘!‘ can be used to specify a command from the history that is substituted into the command line. All occurrences of the form “!n:w” in the command are replaced with the w‘th word from the n‘th line in the command history. Specification of the word is optional.

For example, if the command history is as follows:
  1. show vlan
  2. create vlan vlan_1
  3. show ports
You can type configure vlan !2:2 ipaddress 10.0.0.1 to configure the IP address of vlan_1. Or type !1 to run the command show vlan.

You can also use negative values for n to refer backward through the history. !-1 refers to the previous command executed, which in the preceding example is show ports. To execute a command that was typed two commands back, use !-2. You can use negative values for w to refer to the first (1+|w|) words from the selected line in history.

For example, !2:-1 gives you the first 1+|-1|=2 words from line 2 of the history (in this example, create vlan).

This feature is disabled by default.

Supported Platforms

CLI history expansion is available on all ExtremeSwitching platforms.

Configuring CLI History Expansion

To enable CLI history expansion, use the following command:

enable cli history expansion {session | permanent}

To disable CLI history expansion, use the following command:

disable cli history expansion {session | permanent}

To view the status of CLI history expansion, use the following command:

show switch management