I am working on a remote Debian Jessie server. I have started a screen session, started running a script, then been disconnected by a network timeout.

Now I have logged in again and want to resume the session.

This is what I see when I list screens:

$ screen -ls
There are screens on:
    30608.pts-8.myserver    (11/03/2015 08:47:58 AM)    (Attached)
    21168.pts-0.myserver    (11/03/2015 05:29:24 AM)    (Attached)
    7006.pts-4.myserver (10/23/2015 09:05:45 AM)    (Detached)
    18228.pts-4.myserver    (10/21/2015 07:50:49 AM)    (Detached)
    17849.pts-0.myserver    (10/21/2015 07:43:53 AM)    (Detached)
5 Sockets in /var/run/screen/S-me.

I seem to be attached to two screens at once.

Now I want to resume the session I was running before, to see the results of my script:

$ screen -r 30608.pts-8.myserver
There is a screen on:
    30608.pts-8.OpenPrescribing (11/03/2015 08:47:58 AM)    (Attached)
There is no screen to be resumed matching 30608.pts-8.myserver.

Why I can't I re-attach?

I have the same problem with the other screen:

$ screen -r 21168.pts-0.myserver
There is a screen on:
    21168.pts-0.OpenPrescribing (11/03/2015 05:29:24 AM)    (Attached)
There is no screen to be resumed matching 21168.pts-0.myserver.

4 Answers 4


The session is still attached on another terminal. The server hasn't detected the network outage on that connection: it only detects the outage when it tries to send a packet and gets an error back or no response after a timeout, but this hasn't happened yet. You're in a common situation where the client detected the outage because it tried to send some input and failed, but the server is just sitting there waiting for input. Eventually the server will send a keepalive packet and detect that the connection is dead.

In the meantime, use the -d option to detach the screen session from the terminal where it's in.

screen -r -d 30608

screen -rd is pretty much the standard way to attach to an existing screen session.

  • 30
    To attach to an existing screen session, it's screen -x, screen -rd is to attach to it after having detached it from every terminal it was attached to. In the case of the OP, I'd agree the latter is probably prefered, but in the general case, not necessarily. I generally use -xR to attach or create if there's nothing to attach. Nov 7, 2015 at 21:56

According to the manual you can "resume" only detached screens:

-ls [match]
-list [match]
Do not start screen, but instead print a list of session identification strings (usually of the form pid.tty.host; see Session Name). Sessions marked ‘detached’ can be resumed with screen -r. Those marked ‘attached’ are running and have a controlling terminal. If the session runs in multiuser mode, it is marked ‘multi’. Sessions marked as ‘unreachable’ either live on a different host or are dead. An unreachable session is considered dead, when its name matches either the name of the local host, or the specified parameter, if any. See the -r flag for a description how to construct matches. Sessions marked as ‘dead’ should be thoroughly checked and removed. Ask your system administrator if you are not sure. Remove sessions with the ‘-wipe’ option.

What you want is this option:

Attach to a session which is already attached elsewhere (multi-display mode). Screen refuses to attach from within itself. But when cascading multiple screens, loops are not detected; take care.

  • 6
    With -x a session will still be attached 'somewhere'. To fully take over the session one should use -d|-D (detach options) along with -r|-R (reattach options). Nov 3, 2015 at 9:37
  • 1
    That's an alternative, but may not be what OP needs. I frequently attach from multiple locations. Nov 3, 2015 at 9:40

I attach to screen with the options -rD.

See the manual:

-D -r
Reattach a session. If necessary detach and logout remotely first. 

There are two ways which I know of:

  1. screen -rd <screen_name/id>

This will detach the screen and reattach you. It will close the screen for any pre-attached users.

  1. screen -x <screen_name/id>

This will directly attach you to the screen without terminating attached users. This is primarily used for multi-user displays.

  • Thanks for contributing this answer. The answer is mostly clear, but is repeating much of the information from the other answers. Providing additional contextual information to users (like citing man pages and other resources) can turn a "ok" answer into a phenomenal one. Apr 24, 2023 at 15:51

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .