I am trying to get the PID's and their respective usernames for displaying something similar to the top command in linux. I managed to get the list of PIDs but I am unable to fetch any username for the same. PID from /proc and username is in the /proc/$PID/environ file which while i open to see, has nothing in it for all the PIDs. Kindly suggest how do I go about this..
Asked
Active
Viewed 920 times
0
-
Possible replicate of [this](http://superuser.com/questions/479746/how-to-find-pids-user-name-in-linux) – ojs Oct 14 '15 at 22:12
-
@ojs: I am trying to get the username for each PID form the environ file. When I try to open /proc/$PID/environ on my terminal,there seems to be nothing to display.. I need these values up on my tkinter GUI.. the post you linked is quite different from my requirement.. – Dee Oct 14 '15 at 22:46
-
Actually, your question asks about getting usernames associated with PID's, which is what that question asks also about. Focusing on the environ file is not going to get you anywhere since like you discovered there is not always information in that file. In the status file the UID is always present. – ojs Oct 14 '15 at 23:53
-
1@ojs. My bad, I am learning linux and it went unnoticed. Will try it out. Thanks for pointing it out.. – Dee Oct 15 '15 at 02:56