一个 GNU 屏幕会话可以同时具有分割和非分割工作区吗?

问题描述 投票:0回答:2

使用 GNU 屏幕时,如果您进入屏幕会话,然后将其拆分为所需的布局..是否还可以有一个可以在同一会话中切换到的全屏 shell?或者一旦开始拆分,这是否意味着您被限制在一个视图中,并且只能在可见的拆分窗格之间切换,然后在这些窗格中切换活动 shell?

我经常分割一个屏幕会话来同时监视多个日志或循环命令输出,但我也希望有一个全屏 shell 也可以工作,而不必有一个单独的屏幕会话,我需要从分割/中分离出来附加到全屏等..

如果 screen 不能做到这一点,tmux 或类似的可以做到吗?有什么指点吗?

非常感谢 fLo

linux command-line gnu-screen tmux
2个回答
0
投票

我尝试用屏幕来做到这一点。我能想到的最好的办法就是进行多个会话(使用不同的转义字符)。多个日志窗口均位于一个会话中,另一个会话在一个窗口中包含 screen -r 日志。然后我可以分割日志会话,并且仍然能够循环浏览其他会话窗口。

我相信在 tmux 中这是可能的,但我还没有进行切换。

编辑:在 tmux 中这绝对是可能的,而且非常简单。而且切换非常简单(我开始使用的 tmux 示例中有一个 screen-keys.conf 文件)。这是我编写的一个脚本,用于创建一个包含 3 个窗口的全屏会话,第三个窗口中有 3 个窗格,一个 20%,另外两个 40%。它可以从 crontab 调用:@reboot

tmux new-session -d -s base /bin/bash
tmuxwin() {
  tmux new-window -t base -n $1 /bin/bash
  sleep 1
  shift
  tmux send "$1" C-m
}
tmuxwin second "echo second" 
# These all end up in one window
tmuxwin thirddotone "echo 3.1"
tmuxwin thirddottwo "echo 3.2"
tmuxwin thirddotthree "echo 3.3"

# join 3.1 to 3.2. Give 3.1 20%
tmux select-window thirddotone
tmux joinp -p 80 -s +
# join 3.3 to 3.2. Even split
tmux joinp -s +
# and fix the names...
tmux rename-window three

# I am waiting for you, Vizzini. You told me to go back to the beginning. 
# So I have. This is where I am, and this is where I’ll stay. I will not be moved.
tmux select-window -t 0

所以我的建议是切换到 tmux。我使用 tmux 还不到一周,而且不会回头。


0
投票

9年后我遇到了同样的问题,答案是:

screen
不能做到这一点,如果您需要此功能,最好切换到
tmux
(因为您可能已经这样做了!)

screen
的一个合理解决方案是:
^a Q
,它使当前窗口全屏(“仅”)

© www.soinside.com 2019 - 2024. All rights reserved.