bash history

Updated: 15 April 2023

History doesn’t get written to .bash_history until log off.

Show history

history

Clear session history

history -c

Delete item 234 from history

history -d 234

Writes all current session command history to the HISTFILE

history -w

Search history

Ctrl+R and start typing the previous command. Once a result appears, repeat Ctrl+R to see other matches. Enter to run command.

To re-run a command from history

!<item number>