BASH

Lost Bash-History

Did you ever wonder, why your Bash-History did not reflect the complete history of your commands while you had several connections open to the same server?

Then this will be the solution for you:

You will have to add the following two lines to your .bashrc or .bash_login or whatever you use in your ejnvironment:

shopt -s histappend 

will tell your bash to append all new commands to your history file

PROMPT_COMMAND="history -a > /dev/null"

will trigger bash to save the history file before printing the next prompt.

This will prevent you from loosing any commands in the future.