How can I get a list of all open windows in the command line?
How can I produce a list of all open windows, including dialog boxes and duplicates, from the command line?
Solution 1:
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:
- The window ID. This is used for the [#i -i] switch.
- The desktop ID. It begins counting at 0. -1 means that window is on all desktops. Used with [#d -d] and more.
- The client machine
- 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