You can tell which screen processes are linked to tty
s by looking at the output of lsof
: if a screen client process is connected to the screen interaction processes, then they will share tty devices. So for instance, with:
cas hax$ lsof -n | grep screen | grep tty
screen 1979 cas 3r FIFO 14,2 0t0 7511093 /private/tmp/uscreens/S-cas/1979.ttyp3.calchas
screen 1979 cas 5r VREG 14,2 2271 3155 /private/etc/ttys
screen 2298 cas 0u VCHR 4,3 0t1443440 20004228 /dev/ttyp3
screen 2298 cas 1u VCHR 4,3 0t1443440 20004228 /dev/ttyp3
screen 2298 cas 2u VCHR 4,3 0t1443440 20004228 /dev/ttyp3
screen 2299 cas 3u VCHR 4,3 0t3992 20004228 /dev/ttyp3
screen 2299 cas 4r FIFO 14,2 0t0 7511449 /private/tmp/uscreens/S-cas/2299.ttyp3.calchas
screen 2299 cas 5r VREG 14,2 2271 3155 /private/etc/ttys
We see that there is one interaction scree process, 2298, which has /dev/ttyp3 open. Process 2299 also has this tty open, but process 1979 does not access any tty. So you can infer from this output which child processes are talking to which interaction processes.