Oct 14, 2009

Bash history for multiple shells...

Did you ever configure something and after a while you were not able to remember the exact syntax for the command?
If you used the bash shell, then the command history was your friend:
history|grep <part of command>
and you got everytime the line with the right command back.
Everytime? Hmm no. Sometimes the command did not show up in the history. First guess:
was not big enough, but there is another option for missing entries:
If you work with multiple shells at the same time, then the history will be (over)written by closing the last shell.
But this can be avoided:
After adding the following to your .bashrc, you will never miss an entry again ;-):
shopt -s histappend
For more information of shopt take a look here.


  1. this is included in my default .bashrc on Debian Lenny, but the problem persists :(

  2. Hi,
    i think, you tried the following:
    * command1 in shell1
    * command2 in shell2
    * history in shell1
    -> command2 is not there

    Just try history in shell2 or in an new shell: command2 is there.....