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?


4 Answers 4


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.


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.

  • This is the wmctrl -l output plus some more.
    – Smile4ever
    Dec 29, 2015 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:

   Psensor - Temperature Monitor
   Top Expanded Edge Panel
   Bottom Expanded Edge Panel
   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

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"


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

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.