The ‘history’ command shows all commands kept in the history ring
as numbered list. If the history ring contains
eshell-history-size commands, those numbers change after every
command invocation, therefore the ‘history’ command shall be
applied before using the expansion mechanism with history numbers.
The n-th entry of the history ring can be applied with the ‘!n’
command. If n is negative, the entry is counted from the end
of the history ring.
When history event designators are enabled (by adding
eshell-expand-history-references to
eshell-expand-input-functions), ‘!foo’ expands to the last
command beginning with foo, and ‘!?foo’ to the last
command containing foo. The n-th argument of the last command
beginning with foo is accessible by !foo:n.
The history is loaded to the history ring from the file
eshell-history-file-name at the start of every session, and
saved to that file at the end of every session. The default history
saving behavior is to overwrite the history file with the whole
history ring of the session. If eshell-history-append is
non-nil, the history will instead be saved by appending new
entries from the session to the history file, which could prevent
potential history loss with multiple Eshell sessions. Unlike other
shells, such as Bash, Eshell cannot currently be configured to control
the size of the history file. In particular, when
eshell-history-append is non-nil, the size of the file
will keep increasing, and the recommended way to truncate the file is
to run the ‘history -w’ command in an Eshell session.
Since the default buffer navigation and searching key-bindings are still present in the Eshell buffer, the commands for history navigation and searching are bound to different keys: