Revising bash history

Posted by Andrew Denner on March 19, 2014 · 1 min read

BASH...

One of the biggest flaws of using multiple instances of bash on most linux machines is that the last virtual terminal to close is the one that gets written to bash history. This last in way of recording history is one that causes issues especially when using tools like screen tmux or byobu Fortunately there is an easy update to your .bashrc file:

export PROMPT_COMMAND=’history -a’

The end result is that your bash history will be in chronological order of the commands being entered. While this may not always be the perfect solution it is in most ways better then the alternative of having large chunks of history lost to the ages.

Thanks to this blog for pointing me in the right direction.