18

How can I produce a list of all open windows, including dialog boxes and duplicates, from the command line?

1 Answer 1

20

You can use wmctrl to get a list of all open windows. You will first need to install it.

sudo apt install wmctrl

Then you can just run the command.

wmctrl -l

0x0080006a -1 localhost panel
0x0180007c  0 localhost Mozilla Firefox
0x02600007  3 localhost user@localhost: /home/user - Shell - Konsole
0x00600011  1 localhost KTorrent
0x02200007  0 localhost user@localhost: /home/user - Shell - Konsole
1           2 3         4

The columns:

  1. The window ID. This is used for the [#i -i] switch.
  2. The desktop ID. It begins counting at 0. -1 means that window is on all desktops. Used with [#d -d] and more.
  3. The client machine
  4. The name (long title) of the window. Used with [#r -r] mostly, and can be renamed with [#N -N] and [#T -T].

More examples: wmctrl-examples

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

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