Resuming a screen session on linux

Resuming a screen session

If you are in a screen session on a linux computer, you can detach your session by typing

Ctrl+a then d (detach).

All your screens remain active and can later be resumed. You do this by typing

screen -r.

If there is only one session to be resumed, it will be resumed automatically; otherwise you need to specify which screen session you want to resume by typing

screen -r [pid].[tty].[host].

For example type screen -r 21287.pts-0.formvm2

Something else to note is, if you get disconnected, it’s possible that your session will stay attached to the screen. If a session is attached, you can’t attach to it unless you first detach it. Preceeding the -r with a -d switch will achieve this.

screen -d -r [pid].[tty].[host].

-d is for detach, -r is for resume.