At least in bash 4.3, the documentation for history -a says:
Append the new history lines (history lines entered since the
beginning of the current Bash session) to the history file.
This is unfortunately misleading, since it suggests that the technique of adding "history -a" to one's PROMPT_COMMAND, as suggested here:
would append to one's history file many copies of the lines entered since the beginning of the current session. Fortunately it doesn't do that, but rather appends lines that have not yet been appended. I suggest making this clear, and also mentioning the PROMPT_COMMAND trick, as I look forward to losing far fewer useful commands from my global history by having them instantly saved, and not lost when a long-running terminal hangs and must be killed, or the machine running out of power etc.
-
-