Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

ps ax shows all the running processes. I want to do something similar, but instead of the names of the actual processes, I want the window names listed instead. What Linux command will do this?

share|improve this question
up vote 19 down vote accepted

wmctrl -l may be what you're looking for. The wmctrl program can also perform some simple actions on the windows like moving them around and setting their properties.

share|improve this answer

xlsclients shows the running clients and xwininfo -root -children shows all children of the root window. That also includes some stuff your window manager or desktop renders.

share|improve this answer
    
This is the wmctrl -l output plus some more. – Smile4ever Dec 29 '15 at 17:48

Here is the way to show names only:

wmctrl -l|awk '{$3=""; $2=""; $1=""; print $0}'

because wmctrl -l shows a bit extra info rather than just names required in the question:

like this:

0x020002c6  0 ruslan-Latitude-E6410 fromscratch
0x04600007  0 ruslan-Latitude-E6410 Psensor - Temperature Monitor
0x01600007  0 ruslan-Latitude-E6410 Top Expanded Edge Panel
0x01600017  0 ruslan-Latitude-E6410 Bottom Expanded Edge Panel
0x0200000a -1 ruslan-Latitude-E6410 Desktop
0x05a0000c  0 ruslan-Latitude-E6410 ruslan@ruslan-Latitude-E6410: /var/lib/apt
0x05600085  0 ruslan-Latitude-E6410 index.html (~/Dropbox/cpucraft.com/fromscratch) - gedit

and filtering it by awk we get only names of open windows:

   fromscratch
   Psensor - Temperature Monitor
   Top Expanded Edge Panel
   Bottom Expanded Edge Panel
   Desktop
   ruslan@ruslan-Latitude-E6410: /var/lib/apt
   index.html (~/Dropbox/cpucraft.com/fromscratch) - gedit
   ubuntu - Get a list of open windows in Linux - Super User - Mozilla Firefox
   cpucraft@cpucraft.com - FileZilla
share|improve this answer

If you want simply the titles and no other information (not even whitespace), you can use this:

wmctrl -l | grep -o "$HOSTNAME.*" | sed "s/$HOSTNAME //g"

Result:

linux - How to grep and replace - Stack Overflow - Pale Moon
How can I use a variable in sed? | Unix Linux Forums | Shell Programming and Scripting - Pale Moon
Delete everything after characters * or # or & in text file with GREP - Stack Overflow - Pale Moon
Video.mp4 - VLC Media Player
share|improve this answer

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .