« Back to Processes: Frequently Asked Questions

How to show a running process name and its process ID (PID)

To find running processes by their name and PID , use the pgrep command. As the name implies, it is like the grep command, but for processes.

Examples using pgrep

To only see the PID (or PIDs), use pgrep followed by the process name.

# pgrep nginx

If you want to see both the PID and process name, add the --list-name option.

# pgrep --list-name nginx
51055 nginx
60297 nginx
60298 nginx

This output can also be useful to confirm the right processes are targetted when using the pkill command.

Other questions related to Processes


Is the described answer not working or incorrect, got another tip or question? Share your thoughts!