How to get shared bashed history among different tabs

Posted by Luca Cerone on Ask Ubuntu See other posts from Ask Ubuntu or by Luca Cerone
Published on 2013-06-23T18:25:04Z Indexed on 2013/06/25 22:29 UTC
Read the original article Hit count: 345

Filed under:
|
|
|

I used the answer in http://unix.stackexchange.com/a/1292/41729 to enable real-time shared history among separate bash terminals. As explained in the answer above, this is achieved by adding:

# avoid duplicates..
export HISTCONTROL=ignoredups:erasedups  
# append history entries..
shopt -s histappend

# After each command, save and reload history
export PROMPT_COMMAND="history -a; history -c; history -r; $PROMPT_COMMAND"

This works fine if the bash shells are separate (e.g. opening different bash terminals using CTRL+ALT+T. However it doesn't work if I use tabs (from an open terminal `CTRL+SHIFT+T) rather than new windows. Why this difference in behaviour? How can I share the bash history also among various tabs?

© Ask Ubuntu or respective owner

Related posts about bash

Related posts about bashrc