How can I resume a screen that I did not manage to detach?

Sure, with

screen -d -r

You can choose which screen to detach and reattach as usual by finding the pid (or complete name) with screen -list.

screen -d -r 12345

You should be creating screens with names.

$ screen -S foo

$ screen -list
There are screens on:
        16994.foo       (03/30/15 14:05:13)     (Detached)
        20082.q (12/17/14 18:06:44)     (Detached)
        11008.w (11/12/14 10:52:43)     (Detached)
        1199.irc        (11/12/14 01:34:40)     (Detached)

Then you can reattach screens with

$ screen -dr foo

(which will attach to 16994.foo, detaching any other process) or

$ screen -x i

(which will attach to 1999.irc, which will SHARE the screen with another process)

Naming screens is important I feel.


Following a comment suggested in the post I used:

screen -x <session id>

From the man page: screen -x

-x Attach to a not detached screen session. (Multi display mode). Screen refuses to attach from within itself. But when cascading multiple screens, loops are not detected; take care.

Also researching a bit I discovered other uses for this option, Using screen for remote interaction explains that you can connect from multiple terminals, a kind of remote console sharing system, practically you can see and type remotely in a shared environment.

This can be used when teaching students or setting up things with a colleague.

You can try by connecting to the same screen from two different terminals with the same screen id.(screen -x 4329). What you type in one can be seen in the other and vice-versa.