Get process name by PID

andyortlieb picture andyortlieb · Nov 16, 2010 · Viewed 24.5k times · Source

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.

Answer

Juho Östman picture Juho Östman · Nov 16, 2010

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