Command History in Gaia Clish

You can recall commands you have used before, even in previous sessions.

Command

Description

?

Recall the previous command.

history

Show the last 100 executed commands.

!!

Run the last executed command.

!nn

Run a specific previous command from the history list.

Example: !14

!‑nn

Run the nnth previous command from the history list - counting from the most recent command.

For example, entering !‑3 runs the third from the last command from the history list.

!str

Run the most recent command that starts with str.

Example: !show

Command Reuse

You can combine word designators with history commands to refer to specific words used in previous commands.

Words are numbered from the beginning of the line with the first word being denoted by 0 (digit zero).

Use a colon (:) to separate a history command from a word designator.

For example, you could enter !!:1 to refer to the first argument in the previous command.

In the command "show interfaces", the interfaces is word 1.

Word Designator

Meaning

0

The operation word.

n

The nth word.

^

The first argument (that is, word 1).

$

The last argument.

%

The word matched by the most recent \?str\? search.

Immediately after word designators, you can add a sequence of one or more of these modifiers, each preceded by a colon:

Modifier

Meaning

p

Print the new command, but do not execute.

s/str1/str2

Replace str1 with str2 in the first occurrence of the word, to which you refer.

g

Apply changes over the entire command.
Use this modified in conjunction with s, as in gs/str1/str2.