M HYPE SPLASH
// general

How can I get a list of all open windows in the command line?

By John Campbell

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

1 Answer

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

Sign up or log in

Sign up using Google Sign up using Facebook Sign up using Email and Password

Post as a guest

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