JimmyLiao

JimmyLiao Notes: Developer, Runner, Thinker

Combine TMUX and Bash history

2021-10-15 Bash Tmux

Note if you’re working with multiple sessions and would save command onto history

Edit .bashrc

export HISTFILE=~/.bash_history
export HISTSIZE=100000                   # big big history
export HISTFILESIZE=100000               # big big history
shopt -s histappend                      # append to history, don't overwrite it
unset PROMPT_COMMAND
export PROMPT_COMMAND="history -n;history -w;history -c;history -r;$PROMPT_COMMAND"

Then this will preserve bash history from multiple sessions.

Reference: http://experimentswithlinuxrelatedtech.blogspot.com/2014/07/combine-bash-history-across-multiple.html

comments powered by Disqus