Skip to content

Instantly share code, notes, and snippets.

@daryltucker
Last active October 8, 2025 00:26
Show Gist options
  • Save daryltucker/df70e8e33489b00dba51493dfa52a6e7 to your computer and use it in GitHub Desktop.
Save daryltucker/df70e8e33489b00dba51493dfa52a6e7 to your computer and use it in GitHub Desktop.
Ensure tmux is storing history properly
# Ensure tmux is storing history properly
HISTFILE=~/.bash_history
export HISTCONTROL=ignoredups:erasedups,ignoreboth
if [ -n "$TMUX" ]; then
HISTFILE=$(mktemp)
history -r ~/.bash_history
trap 'history -a ~/.bash_history; rm "$HISTFILE"' EXIT
else
trap 'history -a ~/.bash_history' EXIT
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment