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.)