微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

linux – 如何使用bash脚本中的tmux将屏幕拆分为3

我正在编写一个bash脚本,将屏幕拆分为3并在每个窗格上运行命令.

我基本上想要运行bash脚本,bash脚本应该将我的屏幕拆分为3,然后在窗格中运行top,在另一个窗格中运行htop,在第三个窗格中运行perl re.pl

任何帮助或指示都是赞赏的!

解决方法:

直接的方法是创建一个分离的会话,创建窗格,然后附加到会话.

# -d says not to attach to the session yet. top runs in the first
# window
tmux new-session -d top
# In the most recently created session, split the (only) window
# and run htop in the new pane
tmux split-window -v htop
# Split the new pane and run perl
tmux split-pane -v perl re.pl
# Make all three panes the same size (currently, the first pane
# is 50% of the window, and the two new panes are 25% each).
tmux select-layout even-vertical
# Now attach to the window
tmux attach-session

您也可以在一次调用tmux中执行此操作,但可能没有理由从脚本执行此操作:

tmux new-session -d top \; split-window -v htop \; split-window -v perl re.pl \; select-layout even-vertical \; attach-session

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 [email protected] 举报,一经查实,本站将立刻删除。

相关推荐