0

This question already has an answer here:

As I'm using bash on my Desktop, I have a multi-tab Gnome Terminal window with 6 to 10 shells opened in there.

When I log out of my X session, my ~/.bash_history gets updated in some random way... (at least if you ask me, I have not found a clear pattern to it.)

I'm wondering whether all the history from all the shells I had running could be appended. At this time, it feels like only one of the shells will save its history in the file (or rather they all do and the last one wins?)

What I think would be best is a way to save commands as I issue them from any one instance. That would certainly be the cleanest, if it's doable, as the order would be preserved (i.e. I cannot type in more than one shell at a time, so saving the history will be in the order I typed command in each shell.)

marked as duplicate by Gilles bash Sep 23 '16 at 20:20

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

2

Check this out :

HISTFILESIZE=400000000
HISTSIZE=10000
PROMPT_COMMAND="history -a"

shopt -s histappend

http://mywiki.wooledge.org/BashFAQ/088

  • Wow! Exactly what I was looking for. – Alexis Wilke Sep 23 '16 at 19:42

Not the answer you're looking for? Browse other questions tagged or ask your own question.