Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free.

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

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

share|improve this question
up vote 13 down vote accepted

You can use wmctrl to get a list of all open windows.

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

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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