Clear all

Getting a window's PID by clicking on it

Member Admin
Joined: 2 months ago
Posts: 291
Topic starter  

It is possible to discover which process a window belongs to by using the xprop command line tool (which is part of the Debian package x11-utils).

Execute the following command in a shell:

xprop _NET_WM_PID | sed 's/_NET_WM_PID(CARDINAL) = //'

Click on the window whose process should be identified. (If the desired window is not visible, use Alt+Tab to bring it to the foreground.) The above command should then output the process ID, for example:

To output the parent process ID (PPID), process ID (PID) and the complete command used for executing a process, the following command can be used (in the same way):

ps ww -o ppid=,pid=,cmd= -q `xprop _NET_WM_PID | sed 's/_NET_WM_PID(CARDINAL) = //'`

Example output:

854 2101 /usr/lib/firefox/firefox

Topic Tags