When you want to quit screen and kill all of your windows, you can use this command sequence.
Really quit and kill all your windows [y/n]
This will destroy our screen session. We will lose any windows we have created and any unfinished work.
But we want to explore one of the huge benefits of using “screen”. We don’t want to destroy the session, we simply want to detach it. Detaching allows our programs in the screen instance to continue to run, but it gives us access back to our base-console session (the one where we started “screen” from initially). The screen session is still there, it will just be managed in the background.
[detached from 1835.pts-0.Blank]
So our session is now detached. How do we get back into it?
The “r” stands for reattach. We are now back in our screen session. What if we have multiple screen sessions though? What if we had started a screen session and detached it, and then started a new screen session and detached that as well?
screen Ctrl-a d screen Ctrl-a d
How do we tell screen which session to attach?
There are screens on: 2171.pts-0.Blank (07/01/2013 05:00:39 PM) (Detached) 1835.pts-0.Blank (07/01/2013 03:50:43 PM) (Detached) 2 Sockets in /var/run/screen/S-justin.
Now we have a list of our sessions. We can reattach the second one by typing its id number after the “-r” flag.
screen –r 1835
What if you want to attach a session on two separate computers or terminal windows? You can use the “-x” flag, which lets you share the session.