加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 综合聚焦 > 服务器 > Linux > 正文

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

发布时间:2020-12-14 01:02:37 所属栏目:Linux 来源:网络整理
导读:我正在编写一个bash脚本,将屏幕拆分为3并在每个窗格上运行命令. 我基本上想要运行bash脚本,bash脚本应该将我的屏幕拆分为3,然后在窗格中运行top,在另一个窗格中运行htop,在第三个窗格中运行perl re.pl 任何帮助或指示都是赞赏的! 解决方法 直接的方法是创建
我正在编写一个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

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读