shopt -s histappend

Category: Terminal Configuration

shopt -s histappend

Append to bash history file instead of overwriting

By default, bash overwrites ~/.bash_history when a session exits. If you have multiple terminals, only the last one to close wins. histappend makes all sessions append, preserving history from every terminal.
Looking for more? Search all 7,657 commands — works offline, in English or Spanish, and fixes typos.