Skip to content

Instantly share code, notes, and snippets.

@bmount
Created December 9, 2015 00:12
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save bmount/f9c38d29f6542290ebb8 to your computer and use it in GitHub Desktop.
Save bmount/f9c38d29f6542290ebb8 to your computer and use it in GitHub Desktop.
Keep all of your shell history forever
HOSTNAME_SHORT="${HOSTNAME%%.*}"
his ()
{
grep -r "$@" ~/.history
history | grep "$@"
}
export HISTFILESIZE=10000
export HISTFILE="${HOME}/.history/$(date -u +%Y/%m/%d.%H.%M.%S)_${HOSTNAME_SHORT}_$$"
mkdir -p $(dirname $HISTFILE)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment