41

假设我打开了许多屏幕,我想使用“screen -r”恢复到特定的屏幕会话,这是我执行 screen -r 时得到的结果。有几个合适的屏幕:

12670.pts-8.b-dev03 (Detached)
23662.pts-9.b-dev03 (Detached)
502.pts-1.b-dev03   (Attached)
19972.pts-1.b-dev03 (Detached)
9414.pts-24.b-dev03 (Attached)
16607.pts-1.p-dev03 (Detached)
3015.pts-2.b-dev03  (Detached)
14313.pts-18.b-dev03    (Attached) 
Type "screen [-d] -r [pid.]tty.host" to resume one of them.

我如何恢复其中一个,让我们说最后一个附加的。我试过了 -

screen -r 14313.pts-18.b-dev03
 There is a screen on:
14313.pts-18.b-dev03    (Attached)
There is no screen to be resumed matching 14313.pts-18.b-dev03.
4

1 回答 1

56

措辞有点不走运 - 发生这种情况是因为仍然有一个screen会话连接14313.pts-18.b-dev03,您不能简单地“恢复”一个非分离会话。-x除了使用第二个实例附加到此会话screen(或者,首先分离现有会话)之外,您还需要使用该选项:

-X

  Attach to a not detached screen session. (Multi display mode).
$ screen -xr 14313

如果您希望分离第一个会话:

-d -r

  Reattach a session and if necessary detach it first.
$ screen -dr 14313
于 2013-08-30T08:42:27.270 回答