Linux – List linux processes having windows

linuxpsxorg

How can I list linux processes (like ps aux) but only those having X11 windows?

I guess there must be some simple connection (like always in linux) between the processes and the X server. Is it exposed to lsof ?

Best Answer

xwininfo -tree -root | grep -v "has no name" | grep -v child
It's a bit of a different approach than what you requested: instead of listing processes, it lists windows. If you're looking for a list of process ID numbers, this doesn't accomplish the task. If you're looking for a list of what's running, this does.

Obviously, this approach will not show you the name of any program that has "child" as part of its name. Still, if you're looking for a quick and easy option that will serve most purposes, this may be one.

Oh, and by the way, there are a number of other options to "xwininfo", such as being able to specify the name of just one window (instead of specifying the "root" window).

Related Question