↑↓ move Enter open Esc close

How to Find a Process ID (PID) in Linux

Locate a process PID with ps, pgrep and pidof before inspecting or stopping it.

A PID is the numeric identifier assigned to a running process. Finding the correct PID matters because PIDs are reused after processes exit.

Step by step

1 Search by name

$ pgrep nginx

Returns PIDs for processes whose names match nginx.

2 Show the full command line

$ pgrep -af python

Shows command-line context and matches the full command line.

3 Inspect a PID

$ ps -fp 12345

Confirm the owner, parent PID and command before acting.

4 Use pidof

$ pidof nginx

A simple alternative when you only need PIDs for a program name.

Tips worth knowing

Frequently asked questions

How do I find the PID of a process?

Use `pgrep`, `ps`, `pidof` or a process viewer such as top.

What does PID stand for?

Process ID, the numeric identifier of a running process.

The commands behind it

Concepts involved: Process · PID (Process ID)

More how-to guides