在窗格/窗口之间共享历史记录 [英] Share history between panes/windows

查看:25
本文介绍了在窗格/窗口之间共享历史记录的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有没有办法在 tmux 会话中的窗格/窗口之间共享 shell 命令历史记录?

Is there a way to share the shell command history between panes/windows in a tmux session?

推荐答案

shell 历史与 tmux 关系不大,它与您正在使用的 shell 有关.因此,如果您选择使用 zsh,则默认情况下会启用 iirc.使用 bash,您需要为 .bashrc

shell history has precious little to do with tmux, it has to do with the shell you are using. So if you chose to use zsh it is enabled iirc by default. With bash you need to add some magic to your .bashrc

export PROMPT_COMMAND="history -a; history -n"

这会将您的最后一条命令附加到历史记录并在每个命令之后重新加载您的历史记录.请参阅这篇文章了解更多信息.

this appends your last command to history and reloads your history after each command. See this post for more information.

这篇关于在窗格/窗口之间共享历史记录的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆