Closed SteVwonder closed 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
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