detach screen_关于linux:如何强制将Screen与另一个SSH会话分离?

博客介绍了Screen会话的相关操作。可通过“screen -list”检查会话状态,重新连接会话可用“screen -x”,它能在不断开的情况下二次连接形成多显示模式。还说明了列出会话显示、断开显示等操作,如用“PREFIX *”列出显示,选目标显示按“d”断开。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

Attach here and now. Whatever that means, just do it.

Note: It is always a good idea to check the status of your sessions by means of"screen -list".

BLOCKQUOTE>

您还可以输入screen -x,它输入速度更快,但不完全等效。 它将第二次连接会话而不先断开连接,从而形成多显示模式。

记住"屏幕医生";screen -Dr

尝试使用screen -d -r或screen -D -RR

如果那也不起作用怎么办?

简短答案

重新连接而不弹出其他对象:screen -x

获取显示列表:^A *,选择一个要断开的显示器,然后按d

解释答案

背景:当我寻找具有相同问题描述的解决方案时,我总是着迷于此答案。我想提供更明智的解决方案。 (例如:另一个连接的屏幕具有不同的大小,并且我无法在终端中强制调整其大小。)

Note: PREFIX is usually ^A = ctrl+a

Note: the display may also be called:

"user front-end" (in at command manual in screen)

"client" (tmux vocabulary where this functionality is detach-client)

"terminal" (as we call the window in our user interface) /depending on

1.重新连接会话:screen -x

-x附加到未分离的屏幕会话而不分离它

2.列出此会话的显示:PREFIX *

它是以下项的默认键绑定:PREFIX :displays。

在屏幕上执行该操作,确定我们要断开连接的其他显示器(例如,较小的尺寸)。 (当未选择时,您当前的显示以较亮的颜色/粗体显示)。

term-type   size         user interface           window       Perms

---------- ------- ---------- ----------------- ----------     -----

screen     240x60         you@/dev/pts/2      nb  0(zsh)        rwx

screen      78x40         you@/dev/pts/0      nb  0(zsh)        rwx

使用箭头↑ ↓选择目标显示,然后按d

如果没有任何反应,则您尝试分离自己的显示器,而屏幕将不会分离它。如果是另一个,则在一两秒之内,该条目将消失。

按ENTER退出列表。

可选:为了使内容适合您的屏幕,请重排:PREFIX F(大写F)

屏幕手册页摘录:

displays

Shows a tabular listing of all currently connected user front-ends (displays). This is most useful for multiuser sessions. The following keys can be used in displays list:

mouseclick Move to the selected line. Available when"mousetrack" is set to on.

space Refresh the list

d Detach that display

D Power detach that display

C-g, enter, or escape Exit the list

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值