Easy way to get process information from a window

If you can use Terminal, try this:

xprop | grep WM_CLASS

and your cursor should turn into cross allowing you to click on any window to get its process name. If you just need the PID, try:

xprop | awk '/PID/ {print $3}'

Hope this helps.


Using xprop is already mentioned in this other answer and probably the best solution.

Another way might be to use wmctrl -lp to list all windows managed by your window manager together with their respective process IDs (PID) where possible:

$ wmctrl -lp
0x03a00002  0 1570   type40mark3 XdndCollectionWindowImp
0x03a00003  0 1570   type40mark3 unity-launcher
0x03a00004  0 1570   type40mark3 unity-panel
0x03a00005  0 1570   type40mark3 unity-dash
0x03a00006  0 1570   type40mark3 Hud
0x02c0000a -1 302    type40mark3 Desktop
0x08a00003  0 8861   type40mark3 18.04 - Easy way to get process from window - Ask Ubuntu - Mozilla Firefox
0x08a00033  0 8861   type40mark3 Some other site in a different window - Mozilla Firefox
0x0840b72c  0 20705  type40mark3 bytecommander@type40mark3: ~
0x08800001  0 7389   type40mark3 New Tab - Chromium

You could then use this PID to get more info about the process, e.g. with ps aux -q YOUR_PID_HERE:

$ ps aux -q 20705
USER       PID %CPU %MEM    VSZ   RSS TTY      STAT START   TIME COMMAND
bytecom+ 20705  0.0  0.2 676820 32268 ?        Sl   Jun28   1:58 /usr/lib/gnome-terminal/gnome-terminal-server