Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

how I can tell a process image name (to run from Terminal using sudo) showing on the Ubuntu UI ?

share|improve this question
1  
Have a look here: stackoverflow.com/questions/2041532/… –  sulaweyo May 16 '12 at 14:09
add comment

4 Answers 4

up vote 16 down vote accepted

Per your request on the other question, here is my answer again:

I'm sure there is a cleaner way of doing it, but for your second question you can try this:

   xprop _NET_WM_PID | sed 's/_NET_WM_PID(CARDINAL) = //' | ps `cat`

This will make your cursor a cross with which you can click on an open window. It will report the PID and command in the terminal you ran it in.

In general, xprop and xwininfo will provide you with a lot of information about an open window.

The "apostrophes" I used for surrounding cat are the ~ key on my keyboard without pressing shift. This should give you some more info on the subject:

Grave Accents and the backquote

share|improve this answer
    
xprop says: _NET_WM_PID: not found. This method not foolproof enough... –  Calmarius Oct 3 '12 at 17:04
    
This is easier to remember: xprop | grep PID (although it only prints the process ID) –  KajMagnus Jan 10 '13 at 11:26
add comment

You can try xprop | grep WM_CLASS and then click on the window you are interested in.

Examples:

#> xprop | grep WM_CLASS
WM_CLASS(STRING) = "gedit", "Gedit"

#> xprop | grep WM_CLASS
WM_CLASS(STRING) = "gcalctool", "Gcalctool"
share|improve this answer
add comment

Run this command in a terminal:

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

Your mouse pointer will be replaced with crosshairs; select the window you're interested in.

This method shows just the PID of the process who owns that window (which appears to be what you want).

share|improve this answer
add comment

Running xprop | awk '/_NET_WM_PID\(CARDINAL\)/{print $NF}' and clicking the window you want the PID of will print the PID to the terminal.

share|improve this answer
add comment

Your Answer

 
discard

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.