Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can I assign a name for a screen? [closed]

I'm using the Screen multiplexer tool on the command shell and open a lot of screens. I then forget which process ID associates with which task.

I would like to set a name for a screen, but I can't find an option in the man page.

Currently, listing the screens looks like this:

There are screens on:     5422.pts-1.aws1 (Detached)     5448.pts-1.aws1 (Detached)     5027.pts-1.aws1 (Detached) 3 Sockets in /var/run/screen/S-sb. 

And I would like to see something like this:

There are screens on:     5422.logCleanWorker (Detached)     5448.overNightLongTask(Detached)     5027.databaseOverNightLongTask (Detached) 3 Sockets in /var/run/screen/S-sb. 

How can I do this?

like image 916
spankmaster79 Avatar asked Jul 08 '10 09:07

spankmaster79


People also ask

How do you set a screen session name?

Ctrl + A , : followed by sessionname name (1). 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.

How do I find my screen name Linux?

You might want to check answers here: How do I display the current "session" name or "sockname" of a screen session in the status bar? In short the $STY environment variable is what you are looking for. The session name without ID can be obtained by ${STY#*.} .

How do you delete a screen?

1. From your home screen, choose and hold a blank area of the screen. 2. Swipe to the left until you come to the home screen you wish to delete, and choose Delete.


2 Answers

To start a new session

screen -S your_session_name

To rename an existing session

Ctrl+a, : sessionname YOUR_SESSION_NAME Enter

You must be inside the session

like image 181
user164176 Avatar answered Oct 07 '22 00:10

user164176


To create a new screen with the name foo, use

screen -S foo 

Then to reattach it, run

screen -r foo  # or use -x, as in screen -x foo  # for "Multi display mode" (see the man page) 
like image 27
miedwar Avatar answered Oct 06 '22 23:10

miedwar