Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
menu search
person
Welcome To Ask or Share your Answers For Others

Categories

Let's say I have many screens open, and I would like to resume to a particular screen session using 'screen -r ' this is wahat i get when I execute screen -r There are several suitable screens on:

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.

How do I resume one of them, lets say the last one which is attached. I have tried -

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.
question from:https://stackoverflow.com/questions/18528430/how-to-resume-screen

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
250 views
Welcome To Ask or Share your Answers For Others

1 Answer

The wording is a little unlucky - this happens because there still is a screen session attached to 14313.pts-18.b-dev03 and you cannot simply "resume" a non-detached session. You need to use the -x option in addition to attaching to this session with a second screen instance (or, alternatively, detach the existing session first):

-x

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

If you wish to detach the first session instead:

-d -r

  Reattach a session and if necessary detach it first.
$ screen -dr 14313

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
...