About

Shells designed to be used interactively allow you to recall and edit previous commands, generally with the Up and Down keys. You can often search a string in the command history with Ctrl+R and Ctrl+S, too.

Since these mechanisms work differently in shells, you should usually use this tag together with the tag corresponding to your shell (, , , , …).

There are other command-line programs that provide a history mechanism as part of their line edition features. Many use the library, like .

Some shells have a different feature, known as history expansion (), history substitution () or history expansion (): sequences beginning with ! are replaced by substrings from previous commands, for example !! | less repeats the previous command and pipes it into less.

Further reading

history | show excerpt | excerpt history