我在SSH会话中运行Screen。终端冻结。在重新启动Terminal之后,Screen会话仍然认为它是附加的。也许是吧。也许我不知道那是什么意思。
我想从一个新的SSH登录附加到该Screen会话。我不想杀死屏幕会话,因为重要的事情正在那里发生。:)
我认为我拥有的选项(没有一个我知道如何解决):
我如何分离该屏幕会话? 如何杀死该Screen会话附加到的SSH会话?
我在SSH会话中运行Screen。终端冻结。在重新启动Terminal之后,Screen会话仍然认为它是附加的。也许是吧。也许我不知道那是什么意思。
我想从一个新的SSH登录附加到该Screen会话。我不想杀死屏幕会话,因为重要的事情正在那里发生。:)
我认为我拥有的选项(没有一个我知道如何解决):
我如何分离该屏幕会话? 如何杀死该Screen会话附加到的SSH会话?
当前回答
正如Jose回答的那样,screen -d -r应该可以做到这一点。这是两个命令的组合,摘自手册页。
Screen -d分离已经运行的屏幕会话,Screen -r重新连接现有会话。通过运行screen -d -r,可以强制screen分离它,然后恢复会话。
如果您使用大写的-D -RR,我会引用手册页,因为它太好了,不容错过。
就在此时此地。不管那意味着什么,去做吧。 注意:通过“screen -list”检查会话状态总是一个好主意。
其他回答
正如Jose回答的那样,screen -d -r应该可以做到这一点。这是两个命令的组合,摘自手册页。
Screen -d分离已经运行的屏幕会话,Screen -r重新连接现有会话。通过运行screen -d -r,可以强制screen分离它,然后恢复会话。
如果您使用大写的-D -RR,我会引用手册页,因为它太好了,不容错过。
就在此时此地。不管那意味着什么,去做吧。 注意:通过“screen -list”检查会话状态总是一个好主意。
简短的回答
重新连接而不弹出其他:screen -x 获取显示列表:^A *,选择要断开连接的,按d
解释回答
背景:当我用同样的问题描述寻找解决方案时,我总是会找到这个答案。我愿意提供更合理的解决方案。(例如:另一个附加的屏幕有不同的大小,我不能在我的终端强制调整它的大小。)
注意:PREFIX通常为^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. Reattach a session: screen -x -x attach to a not detached screen session without detaching it 2. List displays of this session: PREFIX * It is the default key binding for: PREFIX :displays. Performing it within the screen, identify the other display we want to disconnect (e.g. smaller size). (Your current display is displayed in brighter color/bold when not selected). 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 Using arrows ↑ ↓, select the targeted display, press d If nothing happens, you tried to detach your own display and screen will not detach it. If it was another one, within a second or two, the entry will disappear. Press ENTER to quit the listing. Optionally: in order to make the content fit your screen, reflow: PREFIX F (uppercase F) Excerpt from man page of screen: 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
尝试screen -d -r或screen -d -RR