builtin
history
Manage the current history list. -s appends synthetic words, -w writes and -r reads entries; reading does not execute them. Use only a private lab shell.
Formal Syntax & Structure
bash syntaxbash
history -s words; history -w file; history -r fileReturn Value
exit status
Manage the current history list. -s appends synthetic words, -w writes and -r reads entries; reading does not execute them. Use only a private lab shell.
Working Example
Example Snippetbash
HISTFILE="$PWD/history.txt"HISTSIZE=20HISTFILESIZE=20history -chistory -s 'printf demo'history -s 'printf example'history -w "$HISTFILE"cat "$HISTFILE"