Skip to main content
6 of 9
Go back to not using -cr, which somehow breaks at shell startup. Sorry.
# Avoid duplicates
export HISTCONTROL=ignoredups:erasedups  
# When the shell exits, append to the history file instead of overwriting it
shopt -s histappend

# After each command, append to the history file and reread it
export PROMPT_COMMAND="${PROMPT_COMMAND:+$PROMPT_COMMAND$'\n'}history -a; history -c; history -r"
Pablo R.
  • 4.8k
  • 1
  • 17
  • 2