recall commands previously typed in a shell or other utility
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 (bash, ksh, tcsh, zsh, …).
There are other command-line programs that provide a history mechanism as part of their line edition features. Many use the readline library, like bash.
Some shells have a different feature, known as history expansion (bash), history substitution (tcsh) or history expansion (zsh): sequences beginning with !
are replaced by substrings from previous commands, for example !! | less
repeats the previous command and pipes it into less
.
Further reading
Accessing the history
- http://unix.stackexchange.com/questions/541/best-way-to-search-my-shells-history
- http://unix.stackexchange.com/questions/1254/how-to-access-the-history-on-the-fly-in-unix
- http://unix.stackexchange.com/questions/3747/understanding-the-exclamation-mark-in-bash