我正在运行 12.04 服务器,当我在 bash 中输入历史记录时,我看到了我在 bash 中输入的大部分命令,但在 tmux 会话中我没有看到我输入的命令。
结束会话后,如何查看我在 Ubuntu 12.04 服务器上的 tmux 会话中运行的命令的历史记录?
Rad*_*anu 36
您必须在多个 bash shell 中保留 bash 历史记录。为此,请确保您的~/.bashrc
文件中有以下几行:
# 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"
Run Code Online (Sandbox Code Playgroud)
来源:https : //unix.stackexchange.com/questions/1288/preserve-bash-history-in-multiple-terminal-windows