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.
migrated from stackoverflow.com Apr 28 '11 at 16:52
This question came from our site for professional and enthusiast programmers.
Ah... Screen, it takes me back ;-)
For one window
For mutliple sessions started from your .screenrc
Here's a link to one on-line copy of the man-page for screen.
Edit : added
To change the current screens name, make a shell script tool like
Untested, I don't have screen available on the system I am working on.
I hope this helps.
There are two concepts here, and I'm not sure which one you have in mind:
Windows have titles, which can be set through the
Sessions can have names. You'd typically set the name on the command line with the
You can name a session when starting it with the
Within a single screen session, you can also name each window. Do this by typing
Naming both screens and terminals within screens is really helpful for remembering what they are and why you started them in the first place.
The answers above already tell you how to name a screen when you start it. They also point out that a screen can't be renamed after it has been started. The window title can be set but the name used to attach to the screen remains pid.pty.host.
However, to achieve a useful effect I've found that using alias work pretty well. If I forget to name a screen or find myself in a session with a bunch of screens up that have naturally become screens for particular tasks I simply set an alias for the command to attach to them.
Issuing the alias command by itself will remind you what screens you have up and command you have set to attach to them.