I'd like to know if it's possible to find out the "command" that a PID is set to. When I say command, I mean what you see in the last column when you run the command "top" in a linux shell. I'd like to get this information from Python somehow when I have a specific PID.
Any help would be great. Thanks.
The proc filesystem exports this (and other) information.
Look at the /proc/PID/cmd symlink.
Finding the command for a specific PID in Linux from Python