History in Bash

History in Bash

Useful tips:

Put this into ~/.bashrc:

However if you want each history item to be available in every shell as soon as you press enter rather than when you close the shell, you’ll need to use this in addition to the above:

Put this into ~/.bashrc:
export PROMPT_COMMAND="history -a; history -c; history -r; $PROMPT_COMMAND"

Use the source ~/.bashrc command or close and reopen your shells for the changes to take affect.

Digital Ocean has a nice blog post on history in bash

Leave a Reply

Your email address will not be published. Required fields are marked *