Get Process Name from PID on Linux

Get Process Name from PID on Linux

When managing or troubleshooting processes on a Linux system, you might need to find the name of a process by its PID (Process ID). This can be useful for debugging, monitoring, or system administration tasks. This tutorial explains how to get process name from PID on Linux.

The easiest way to get the process name from a PID is by using the ps command:

ps -p <PID> -o comm=

The meaning of options:

  • -p <PID> specifies the process ID you want to check.
  • -o comm= tells to output only the command name (process name) without headers.

For example, the following command finds the name of the process with PID 1182:

ps -p 1182 -o comm=

Output example: mysqld.

Leave a Comment

Cancel reply

Your email address will not be published.