Linux - SoftwareThis forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
Hi.. I'm running X, and I want to find the process id of a program on the screen so that I can strace it.
However, the closest I've come is finding xkill, which works by telling the X server to close that connection, which usually (always?) kills the process that put the screen there.
I've found xwininfo and xlsclients commands, but they don't seem to have pid information.
I know that X isn't supposed to know the pid of processes talking to it, but I'm sure that if I knew the connection details I could use netstat -p or lsof | grep to find the actual process.
The program is 'up2date', and 'ps aux | grep up2date' found these three processes:
root 3181 0.0 0.7 12672 3856 ? SN 12:57 0:00 up2date
root 3182 0.0 0.2 5020 1216 ? SN 12:57 0:00 /usr/sbin/userhelper -w up2date
root 3183 1.1 14.1 79072 68504 ? RN 12:57 1:16 /usr/bin/python -u /usr/sbin/up2date
One (or more) of these three has the window open. As it stands, I'd have to kill them off one by one to determine which one has the window I'm interested in. In addition, if I kill off one of them, the others might quit as well.
In short, I'm guessing. I don't like guessing, it's not very scientific.
For every window on the screen, we know there is a definite process id behind it. We just don't know how to go from window-id to process-id, short of killing stuff and seeing what's left.
The goal for today is to make 'up2date' use a server on the same continent as I'm on, but to do that I need to strace it to find out where it gets its configuration from. Right now I'm in Canada and it's getting files from Czechoslovakia(!), and the speed is not good. I'm going to fix it to find the closest (ping-wise) server and use that. I might even go so far as to find the best bandwidth, but that's a more tedious problem to solve.
The long term goal is to figure out how to track down a process id from a window, in case the name of the program is unknown. This would come in handy if some hacker were to get onto my system and pop up a window on my screen, as typically they try and hide their programs with unrelated names (So that "ps aux | grep hackerprocess" doesn't work).
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.