Categories
Linux

appending the bash history

One common problem with the default settings of bash or the defaults settings of your bash_profile ~/.bashrc is the bash_history.

When you logout from your shell all the commands you entered there are writteen to the bash_history. Hmmm what happens when you logout from 2 or more shells ? Yes the last history list is written = you loose what you typed in the others shells you closed.

Instead of overwriting the history list to the history file you can append it.

shopt -s histappend
export HISTSIZE=4096

We also change the default HISTSIZE from 500 lines to 4096

Add the commands you your ~/.bashrc ~/.bash_profile and you are up and running