Skip to content

Instantly share code, notes, and snippets.

@stinkymatt
Created April 17, 2015 05:12
Show Gist options
  • Save stinkymatt/cd5ed77b4d89a3163c62 to your computer and use it in GitHub Desktop.
Save stinkymatt/cd5ed77b4d89a3163c62 to your computer and use it in GitHub Desktop.
Consolidate bash history files per host per day.
#Bash History Project
#References:
# http://unix.stackexchange.com/questions/1288/preserve-bash-history-in-multiple-terminal-windows
# http://unix.stackexchange.com/questions/1288/preserve-bash-history-in-multiple-terminal-windows#3055135
# http://tldp.org/HOWTO/Bash-Prompt-HOWTO/x264.html
TITLEBAR='\[\033]2;\u@\h:\w\007\]'
PS1="${TITLEBAR}(\!) \t \$ "
#export HISTCONTROL=ignoredups
export HISTSIZE=10000
export HISTIGNORE="ls:ls -l:pwd:cd:cd .."
export HISTTIMEFORMAT='%b %d %H:%M:%S: '
shopt -s histappend # append to history, don't overwrite it
export PROMPT_COMMAND="history -a; history -c; history -r;"
export HISTFILE=~/.histories/hist.`echo $HOSTNAME | cut -d. -f1`_`date +%F`.txt
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment