History is loaded from file during bash startup. And file is saved automatically when bash exits. During bash execution, history is kept in memory and not synchronized with history file nor multiple bash instances.
You can use history
builtin command to manually save your current history to file or to load it from disk (see help history
for details).
Only one .bash_history file exists (because two files can't have the same name), but it's possible to set the HISTFILE
variable to use other file.
Some useful quotes from man bash
(HISTORY
section):
On startup, the history is initialized from the file named by the variable HISTFILE (default ~/.bash_history).
and
When a shell with history enabled exits, the last $HISTSIZE lines are copied from the history list to $HISTFILE.