LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Server (https://www.linuxquestions.org/questions/linux-server-73/)
-   -   What pts is a screen associated with (https://www.linuxquestions.org/questions/linux-server-73/what-pts-is-a-screen-associated-with-4175483407/)

coloradoruss 11-04-2013 08:44 PM

What pts is a screen associated with
 
I have several screens running, and I would like to be able to tell what process is running in each one. I can run ps -aux and grep pts/# to find what processes are associated with a particular pts, but I have been unable to correlate this to a screen.

What I want to do is determine what commands to send to the screen based on what is running in it, and if nothing, just kill it.

I have been reading for hours, but I can not find a way to figure out what pts a screen -dr nameHere would go to.

Any help would be appreciated. Thanks!

Ygrex 11-05-2013 01:59 AM

supposing you are asking about displays in X11, this should do the trick in most cases:
Code:

$ cat /proc/self/environ | grep -z '^DISPLAY=' ; echo
DISPLAY=:0.0


pan64 11-05-2013 02:03 AM

I would rather look for parent and/or child processes (of screen)


All times are GMT -5. The time now is 06:02 PM.