Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

how do you know your currently attached gnu screen session

Tags:

gnu-screen

We used gnu screen a lot in the office and sometimes if I don't take note, I end up getting lost as to what screen session I already am in.

So my question is, how do you know what screen session you're in? Do you have a way to check?

CLARIFICATION: What I need to know is when I do a:

~$ screen -ls

and I see something like:

There is a screen on:
    4732.work_Sept42012     (Attached)
    3551.web01  (Attached)
    5521.mysql01 (Attached)
    1255.tomcat05 (Detached)
    3326.oracle15 (Attached)

 1 Socket in /tmp/uscreens/S-icasimpan.

How do I know if I am currently connected to any of the attached session?

Thanks in advance.

like image 569
icasimpan Avatar asked Dec 21 '22 16:12

icasimpan


1 Answers

In addition to the sessionname screen command, screen sets the STY environment variable for processes it starts. You can check the value of this variable from a shell:

$ echo $STY
5521.mysql01
$
like image 133
bonsaiviking Avatar answered Jan 31 '23 01:01

bonsaiviking