xlsclients
is a utility for listing information about the client applications
running on a display. It may be used to generate scripts representing
a snapshot of the the user's current session.
Options
-displaydisplayname
This option specifies the X server to contact.
-a
This option indicates that clients on all screens should be listed.
By default, only those clients on the default screen are listed.
-l
This option indicates a long listing showing the window name,
icon name, and class hints in addition to the machine name and
command string shown in the default listing.
-mmaxcmdlen
This option specifies the maximum number of characters in a
command to print out. The default is 1000.
Environment variables
DISPLAY
To get the default host, display number, and screen.