Skip to content

Instantly share code, notes, and snippets.

@pudquick
Last active October 21, 2020 01:55
Show Gist options
  • Save pudquick/c241cb84f28250a77232 to your computer and use it in GitHub Desktop.
Save pudquick/c241cb84f28250a77232 to your computer and use it in GitHub Desktop.
Unified history in bash (with a focus on OS X)
# You need to add these two lines to your bash environment
shopt -s histappend
export PROMPT_COMMAND="${PROMPT_COMMAND:+$PROMPT_COMMAND$'\n'}history -a; history -c; history -r"
# In most *nix variants, that means adding them to your .bashrc file.
# However, on OS X, the default session for Terminal is a login session,
# meaning that it doesn't run .bashrc.
# As such, you'll need to include these commands into your
# .profile or .bash_profile (whichever you have/want).
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment