The answers in the link that you provided from the Super-Users site shouldn't necessarily be viewed as 'workarounds' to the
history command's default behavior. The bash shell has some sane, out of the box, default behavior.
I would highly recommend reading How can I avoid losing any history lines? for an explanation of what these modifications to
history are doing. Additionally, there are some reasonable concerns to be aware of in regards to why this is not the default behavior of the
performance - Since you are saving every command from every window with
history -a, the
.bash_history file can grow quite large and require greater resources to load the bash shell. This can result in longer start up times(for your terminal sessions, not overall system startup, per se.).
organization - (from the above article) "the history commands of simultaneous interactive shells (for a given user) will be intertwined. Therefore the history is not a guaranteed sequential list of commands as they were executed in a single shell."
If you are concerned about further securing the bash shell and the .
bash_history file through auditing, take a look at this article: How do I log history or "secure" bash against history removal?
On occasion(i.e. unstable systems, or power source), I have found the below commands useful.
You can add something similar to the following lines to your
export HISTSIZE PROMPT_COMMAND
shopt -s histappend
Finally, exit your editor and source your