![Byobu 的 windows.tmux 的正確格式?](https://rvso.com/image/1316762/Byobu%20%E7%9A%84%20windows.tmux%20%E7%9A%84%E6%AD%A3%E7%A2%BA%E6%A0%BC%E5%BC%8F%EF%BC%9F.png)
在 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
像這樣的東西應該有效,但你可能還想研究一下tmuxator或者多路復用器在 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 中使用目前目錄建立新視窗