Search code examples
pythonprocesspid

Get process name by PID


This should be simple, but I'm just not seeing it.

If I have a process ID, how can I use that to grab info about the process such as the process name.


Solution

  • Under Linux, you can read proc filesystem. File /proc/<pid>/cmdline contains the commandline.