history is a Builtin Command that shows the history of the command executed.
A space at the start of a command will stop the command (and any password) from being stored in the history.
history [n]
history -c
history -d offset
history -anrw [filename]
history -p arg [arg ...]
history -s arg [arg ...]
where:
If the shell variable HISTTIMEFORMAT is set and not null, it is used as a format string for strftime to display the time stamp associated with each displayed history entry.
The time stamp information associated with each history entry is written to the history file.
export HISTTIMEFORMAT="%d/%m/%y %T
No intervening blank is printed between the formatted time stamp and the history line.
A colon-separated list of patterns used to decide which commands should be saved on the history list.
Characters controlling history expansion and quick substitution.
The value of the history file
All shortcuts can be found with the bind command
bind -P | grep history
beginning-of-history can be found on "\e<", "\e[5~".
dynamic-complete-history can be found on "\e\C-i".
end-of-history can be found on "\e>", "\e[6~".
forward-search-history can be found on "\C-s".
history-and-alias-expand-line is not bound to any keys
history-expand-line can be found on "\e^".
history-search-backward is not bound to any keys
history-search-forward is not bound to any keys
next-history can be found on "\C-n", "\eOB", "\e[B".
non-incremental-forward-search-history can be found on "\en".
non-incremental-forward-search-history-again is not bound to any keys
non-incremental-reverse-search-history can be found on "\ep".
non-incremental-reverse-search-history-again is not bound to any keys
previous-history can be found on "\C-p", "\eOA", "\e[A".
reverse-search-history can be found on "\C-r".
vi-fetch-history is not bound to any keys
The first number of the history output is the history id
!historyId
# mutliple
!historyId1; !historyId2;
Lets you search your command history for a search term.
Steps to search commands that included the search term 'youpi':
history | grep mySearchTerm