Sometimes I face some problems in display and mostly I do want to know which files or processes are using the DISPLAY environment variable.
So how to list all processes that having DISPLAY set?
I came up to this command after many searches and tries:
A sample of the output is:
Thats some pretty nifty command line scripting! Im gonna make a copy at that script in case I have to hack it to figure something else.
Ideally all the current processes that correspond to the programs that you execute on the local machine, post login, are gonna carry the same display variable as your first open pts (pseudo-terminal session) console.
For instance when you open your first terminal session (gnome-terminal) and run the who or w command you will notice some output like this:
or some folks might look like this (but not it your case)
using the light display manager if the DISPLAY variable is set differently for post login execution of shells (e.g. :0.0), then the environment variable for DISPLAY would yield the same display variable as the post-login display variable of the first open pts (:0.0), but the host variable, at login, would still be (:0).
By echoing the DISPLAY variable, or running set piped to less as shown below:
you can also check your sessions current display variable, and see what it is set to, for post login execution of shells. So basically the display variable of the processes you execute, are gonna have the same display variable as your first open pts, post login.
The output of the script that you posted, suggests that your first open pts is gonna have the same display variable as your display manager's login, in this case :0.
Now for the second example the output would look something like this:
Also for additional reading you can look at the the man pages for ptmx
This might lend you some insight into the master-slave relationship of pseudo-terminals.
I hope this helps!
Also where did you get that script at?