.bash_history in F15/16 randomly truncated/incomplete/damaged

Mike Wohlgemuth mjw at woogie.net
Wed Mar 28 14:31:54 UTC 2012


On 03/28/2012 09:51 AM, Reindl Harald wrote:
> usually bash writes down .bash_history on close
> try it out with "cat ~/.bash_history" and you will
> not see the entries of your current session!
>
> so if you have more than one bash-instance open
> all of them writing down their history and the
> last one wins
>
That behavior has always annoyed me, since I always seem to be missing 
useful parts of my history.  Recently, someone suggested I add the 
following to my .bash_profile:

export HISTSIZE=5000
shopt -s histappend
PROMPT_COMMAND="history -a;$PROMPT_COMMAND"

First, it increases my history size, and second, it appends the current 
shell's history to the file, not overwrites it, and third, it updates 
the history file with each command that is entered.

I am much happier now.

Woogie


More information about the users mailing list