Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I display the current "session" name or "sockname" of a screen session in the status bar?

Tags:

gnu-screen

I run multiple screen sessions each created with 'screen -S name' and I would like to be able to display in the status bar the name I used to create the current screen session.

However, I cannot seem to accomplish this. Any ideas?

like image 756
Neg_EV Avatar asked Mar 19 '10 18:03

Neg_EV


People also ask

How do I find my current session name?

Type the following three keystrokes / commands one after the other: Ctrl-A then : then sessionname (Ctrl-A should be substituted with whatever you have set for the screen control keystroke, if you have changed it from the default of Ctrl-A.) You will then see output similar to: This session is named '31438.

How do I get the current screen name in 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 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 you set a screen session in Linux?

On the command prompt, type screen . Run the desired program. Use the key sequence Ctrl-a + Ctrl-d to detach from the screen session. Reattach to the screen session by typing screen -r .


1 Answers

The easiest way to display the sessionname is

  C-a :    sessionname 

(without specifying a name after sessionname)

See the "CUSTOMIZATION" section in man screen

like image 159
nicola Avatar answered Oct 14 '22 05:10

nicola