0

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..

4
  • Possible replicate of this
    – ojs
    Commented Oct 14, 2015 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
    Commented Oct 14, 2015 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
    Commented Oct 14, 2015 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
    Commented Oct 15, 2015 at 2:56

0

You must log in to answer this question.

Browse other questions tagged .