SteVwonder / dotfiles

My OS X / Ubuntu dotfiles.
MIT License
0 stars 0 forks source link

Record all shell history #5

Closed SteVwonder closed 8 years ago

SteVwonder commented 8 years ago

Bash: PROMPT_COMMAND HISTFILE

zsh: append but don't share append & share oh-my-zsh history plugin Need to determine best way to get a separate file for each day

SteVwonder commented 8 years ago
TODAYS_DIR=${HOME}/.bash_history_dir/$(date "+%Y")/$(date "+%m")/$(date "+%d")
MYTTY=$(basename `tty`)
mkdir -p ${TODAYS_DIR}
export HISTFILE=${TODAYS_DIR}/"$(date "+%H-%M-%S")_${MYTTY}.hist"
export HISTFILESIZE=1000000
export HISTIGNORE='ls:bg:fg:history'
export PROMPT_COMMAND='history -a' #record each command as it is executed, rather than at the end