Skip to content

Instantly share code, notes, and snippets.

@adrianlungu
Created October 2, 2019 07:52
Show Gist options
  • Save adrianlungu/67a5e349e16252e0b9cbe89aced51c84 to your computer and use it in GitHub Desktop.
Save adrianlungu/67a5e349e16252e0b9cbe89aced51c84 to your computer and use it in GitHub Desktop.
Bash History per iTerm Tab/Session
# Unique history file per shell session.
export HISTSIZE=1000
export HISTFILE=~/.bash-history-${ITERM_SESSION_ID}
# export HISTFILE=$HOME/.bash_hist_${HOSTNAME/.*/}_$(basename $(tty))
export SAVEHIST=1000
# New - remove if not working properly
export HISTCONTROL=ignoreboth
# export HISTCONTROL=ignoredups
# For iTerm2 to show the directory it's in
if [ $ITERM_SESSION_ID ]; then
export PROMPT_COMMAND='echo -ne "\033];${PWD##*/}\007"; ':"$PROMPT_COMMAND";
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment