Skip to content

Instantly share code, notes, and snippets.

@ryenus
Last active April 23, 2016 01:16
Show Gist options
  • Save ryenus/ee850aea0f0f910ab240 to your computer and use it in GitHub Desktop.
Save ryenus/ee850aea0f0f910ab240 to your computer and use it in GitHub Desktop.
unlimited bash history
export PATH=$(brew --prefix coreutils)/libexec/gnubin:$PATH
# append to the history file, don't overwrite it
shopt -s histappend
# for setting history length see HISTSIZE and HISTFILESIZE in bash(1)
HISTSIZE=-1
HISTFILESIZE=-1
#HISTFILE="${HOME}/.history/$(date -u +%Y/%m/%d.%H.%M.%S)_${HOSTNAME_SHORT}_$$"
HISTFILE="${HOME}/.history/$(date -d 'last sat +1 day' +%Y/%V/%m.%d)_${HOSTNAME%%.*}"
mkdir -p "$(dirname "$HISTFILE")"
# other stuff ...
@ryenus
Copy link
Author

ryenus commented Dec 10, 2015

This requires GNU date command from Homebrew, hence PATH needs to be set first.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment