0

Let's attach to not-detached session few times:

In one terminal (say having pts 11):

$ screen -x    #say this will get pid 111

In another one (say pts 22):

$ screen -x    #get pid 222

Is there a way to programatically distinguish these two from inside of the screen?

OR (in another words)

Is there a way to link pid 111/222 or pty 11/22 to currently opened window inside?

Note I can tell "manually" by invoking screen command ":displays" (C-a *). But it seems that is not possible to redirect output of screen commands somewhere (to be clear: screen commands (C-a :), not commands in the screen).

user1558113
  • 146
  • 1
  • 5

1 Answers1

0

:displays is a missing command within the possibilities offered by the -Q command-line option of screen

Currently, you use the best existing option by typing manually C-a * to get the display list.

You could surely automatize this outside of the screen by using tools like expect to send keystrokes and script to log the session, but it would be a lot of work.

To do this inside of the screen (i.e. making bash log the user performing an action for instance), it's quite impossible unless you made some assumptions. See for instance Access SSH client IP address, within a screen session

Community
  • 1
  • 1
Adam
  • 17,838
  • 32
  • 54