Setting a name for a screen session

gnu-screen

Is there a way to give a particular name to a unix screen session? For instance, say I'm running the same program multiple times, each with different parameters and I want to tell which one is which.

Best Answer

You can name a session when starting it with the -S name option. From within a running screen, you can change it by typing

Ctrl+A,: followed by sessionname name(1).

You can view running screen sessions with screen -ls, and connect to one by name with

screen -xS name

(1):name is and an arbitrary string which will become the new session name. If the session name contains whitespace, quote it with single or double quotes.

Within a single screen session, you can also name each window. Do this by typing Ctrl+A, A then the name you want. You can view an interactive list of named windows by typing Ctrl+A, ", and select the one you want to switch to from that list.

Naming both screens and terminals within screens is really helpful for remembering what they are and why you started them in the first place.

Related Question