Take the 2-minute tour ×

I have a screen session on a server. I lost wireless connection. When reconnecting to the server, the screen session is shown as "Attached" in "screen -ls". I cannot detach it by "screen -d session#" however, neither can I kill it by "screen -X -S session# quit". How can I deal with it?

Thanks and regards!

share|improve this question

1 Answer 1

up vote 3 down vote accepted

The brute-force way of doing it is:

ps waux | grep screen

Find the pid and then do a kill -9 on it... Otherwise, try these command-line arguments to screen:

-D [pid.sessionname] Do not start screen, but instead detach a screen session running elsewhere (see section 8.1 Detach). '-d' has the same effect as typing C-a d from the controlling terminal for the session. '-D' is the equivalent to the power detach key. If no session can be detached, this option is ignored. In combination with the -r/-R option more powerful effects can be achieved:

-d -r
    Reattach a session and if necessary detach it first. 
-d -R
-d -RR
-D -r
    Reattach a session. If necessary detach and logout remotely first. 
-D -R
-D -RR

Note: It is a good idea to check the status of your sessions with screen -list before using this option.
share|improve this answer
Thanks. But ps waux | grep screen does not show the screen session. screen -D is also stuck. –  Tim Mar 8 '10 at 23:12
Have you tried "screen -D -RR <sessionname>" ? –  Trevoke Mar 9 '10 at 13:53
"screen -D -RR <sessionname>" worked when "screen -D -RR" didn't, even when I had only one screen session in "screen -ls". Thanks! –  madh Apr 5 '11 at 19:16

Your Answer


