How do I see the history of the commands I have run in tmux?

Solution 1:

You have to preserve bash history in multiple bash shells. To do this, be sure that you have the following lines in your ~/.bashrc file:

# avoid duplicates..
export HISTCONTROL=ignoredups:erasedups

# append history entries..
shopt -s histappend

# After each command, save and reload history
export PROMPT_COMMAND="history -a; history -c; history -r; $PROMPT_COMMAND"

Source: https://unix.stackexchange.com/questions/1288/preserve-bash-history-in-multiple-terminal-windows