tmux可以将命令保存到文件中吗,例如.bash_history吗? [英] Can tmux save commands to a file, like .bash_history?

查看:419
本文介绍了tmux可以将命令保存到文件中吗,例如.bash_history吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

tmux是否支持将以"C-b:"模式键入的命令保存到文件中?我宁愿浏览已经输入的内容,也不必在手册页中查找每个命令.

Does tmux support saving to a file the commands typed in "C-b :" mode ? I'd rather look through the ones I already typed than have to look each command up in the man page.

推荐答案

history-file选项可以满足您的需求.

There is history-file option which does what you are looking for.

历史文件路径

如果不为空,则tmux将在退出时将命令提示符历史记录写入该文件,并从启动时将其加载.

If not empty, a file to which tmux will write command prompt history on exit and load it from on start.

将此添加到您的.tmux.conf

set -g history-file ~/.tmux_history

注意,它是在2.1版本中添加的.如果您有较旧的tmux版本,请阅读 https://unix.stackexchange.com/questions/26548/write-将所有tmux滚动回一个文件

Note it was added in 2.1 version. if you have older version of tmux read https://unix.stackexchange.com/questions/26548/write-all-tmux-scrollback-to-a-file

这篇关于tmux可以将命令保存到文件中吗,例如.bash_history吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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