Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can I get currently attached screen session name?

I'm writing a script which needs the name of the currently attached screen session's name if there's any.

like image 249
ertan Avatar asked May 31 '13 02:05

ertan


People also ask

How do I find my 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 attach to an already attached screen session?

You can use screen -x to attach a screen session that's already attached somewhere without detaching it first. This can have side effects if the other place is already attached or is in a window that is a different size than your current one.

How do I change my screen session name?

In this blog post I'm explaining how to rename an already existing screen session. You can simply create a new screen session by executing the “screen” command. If you want a specific name for your newly creating screen session, use the “-S” switch along with the screen command.

How do I name my GNU screen?

You can specify the name you want for a window with the ' -t ' option to the screen command when the window is created (see Screen Command). To change the name after the window has been created you can use the title-string escape-sequence ( ESC k name ESC \ ) and the title command (C-a A).


1 Answers

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.

like image 130
Martin Mrazik Avatar answered Sep 30 '22 18:09

Martin Mrazik