Put<p><pre><code>    shopt -s histappend
    export PROMPT_COMMAND=&quot;history -a;$PROMPT_COMMAND&quot;
</code></pre>
in your ~&#x2F;.bashrc.<p>Also, if you want fresh history in an already opened window (assuming you added the above), do &quot;history -n&quot;. E.g. if you typed &quot;longcommand&quot; in window1, then switch to window2, do &quot;history -n&quot; and uparrow, and &quot;longcommand&quot; will be there.