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.
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.
CLI history expansion is available on ExtremeSwitching X435, X440-G2,X450-G2, X460-G2, X465, X590, X620, X670-G2, X690, X695, and X870 series switches.
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 management