My ssh connection is unreliable, so I've been studiously using screen and detaching every time I start a long-running process. The screen part I know is necessary, but is the detaching as well? Thanks.

  • if you start the screen as dettached, that screen session will remain active even after you get disconnected from your ssh connection. The only way the screen session stops working is if someone SSHs into the machine your working on and does a screen wipe of all active sessions
    – ryekayo
    Oct 14, 2014 at 22:13
  • 1
    @ryekayo What if I'm still attached to the screen when I get disconnected? That's the question.
    – bongbang
    Oct 14, 2014 at 22:19
  • 2
    No it is still active. Stays active even after you get disconnected. Like I said, only way it gets disconnected is if someone goes into the machine and does a screen wipe
    – ryekayo
    Oct 14, 2014 at 22:19

1 Answer 1


You do not have to disconnect, if the connection gets interrupted you can use screen -dr to reattach to a already running screen session that wasn't properly disconnected from first.

Simply list out the screen sessions using screen -ls:

$ screen -ls
There is a screen on:
    10266.somesession   (Attached)
1 Socket in /var/run/screen/S-slm.

Note the sessions name, 10266.somesession and reattach to it like so:

$ screen -dr 10266.somesession

NOTE: So long as the other system where screen is running is not rebooted or the parent process that owns screen is not killed, your screen sessions will remain intact.

You must log in to answer this question.

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