Managing multiple GNU screen sessions

2010/02/01

I use GNU screen constantly: locally and on remote servers.

I have often found myself wanting to save a remote session for one site, and either switch to another session on the same computer, or go back to the same session later. Ctrl+A Ctrl+D does detach the session, but I've always thought you were limited to one.

After re-reading the manpage, I realized that the functionality I needed was available.

All you have to do is to set the 'Session name', which can be done in two ways:

1. at the moment you create the session:

$ screen -S my_session_name

2. from inside the sceen session via the following command:

Ctrl + A, :sessionname my_session_name

You can re-attach to the session as follows:

$ screen -r my_session_name