And*_*rei 13 bash command-history zsh synchronization
我经常发现自己在 Bash 和 Zsh 之间切换,并使用历史搜索功能来恢复命令。
但是,由于 Bash 和 Zsh 具有不同的历史文件,我经常发现我正在搜索的命令已在另一个 shell 中执行。
有没有办法在两者之间共享或同步历史?
Ruf*_*ufo 10
如果您使用 bash 和 zsh 的默认值:
$ cat ~/.histfile >> ~/.bash_history
$ youreditor ~/.zshrc
# Here change your config to:
HISTFILE=~/.bash_history
$ rm ~/.histfile
Run Code Online (Sandbox Code Playgroud)
现在您在两个 shell 中都有相同的历史文件。