Byobu 的 windows.tmux 的正确格式是什么?

Byobu 的 windows.tmux 的正确格式是什么?

在 Byobu 5.17(使用 tmux 1.6)中,我应该如何格式化 windows.tmux 文件?我搜索了一下,但找不到合适的答案。

作为参考,这是我想要的屏幕版本:

screen -t log watch -n 10 tail -n 5 /var/log/syslog /var/log/auth.log /var/log/ dmesg
screen -t mem watch -n 30 "df -h; echo ""; free -mt"
screen -t top top
screen -t bash /bin/bash

非常感谢。

答案1

类似这样的方法应该可以工作,但你可能还想研究一下多路复用器或者多路复用在 YAML 中指定 tmux 配置文件。

new -s tmuxs # creates a new tmux session, replace "tmuxy" with whatever you'd like to name the session
new-window -n log 'watch -n 10 tail -n 5 /var/log/syslog /var/log/auth.log /var/log/dmesg'
new-window -n mem 'watch -n 30 "df -h; echo ""; free -mt"'
new-window -n top 'top'
new-window -n bash

它非常不言自明,创建一个会话,然后开始创建窗口,通过它们命名'-n'并包含您想要运行的命令作为最后一个参数。

答案2

我终于找到了如何让它工作的方法。首先,您需要更新到 Byobu 5.85 或更高版本。以下是修复对应的提交还有Ubuntu 的 PPA

首先,检查该行是否取消注释source-file $BYOBU_CONFIG_DIR/windows.tmux/usr/share/byobu/profiles/tmuxrc否则它将不起作用。

正如您在更新的文档中看到的,您需要使用分号将命令串联起来。要来自 Arch Wiki 的 tmux 示例并使它工作起来如下:

new -A -s SessionName -n WindowName nano;
neww -n foo/bar top;
splitw -v -p 50 -t 0 top;
selectw -t 1;
selectp -t 0

不要忘记添加-A到 new/new-session 命令,否则 Byobu 将无法重新连接到现有会话。

如果您使用的是 14.04 或低于 tmux 1.9 的版本,则应更新到较新版本的 tmux,以避免遇到此问题:在 tmux 中使用当前目录创建新窗口

相关内容