Getting info about a screen session from an external script

Posted by valadil on Stack Overflow See other posts from Stack Overflow or by valadil
Published on 2010-05-23T22:00:17Z Indexed on 2010/05/23 22:00 UTC
Read the original article Hit count: 183

Filed under:

I have a screen session. I'd like to be able to figure out what's running in it from an external script. I've gotten this far:

ps --ppid $PID -o comm=

That prints a list of all the child processes of the screen. What I haven't been able to figure out so far is:

  • What window is selected/active in a screen session.
  • If $PID is an attached screen it has no children. How do I find out what session it's attached to?

I imagine the solution will involve some 'screen -X' voodoo, but I haven't figured out how to make that happen yet and google has been less than helpful.

© Stack Overflow or respective owner

Related posts about screen