Find a Process PID by Name with pgrep
Use pgrep -fl to instantly look up the PID of any running macOS process by matching its name or command line.
01Command
$ pgrep -fl "<name>"02What it does
pgrep scans the process table and prints only the process IDs that match your pattern, without the noise of a full ps listing. The -f flag matches against the full command line, which helps when the binary name differs from what you see in Activity Monitor, and -l prints the process name alongside each PID so you can confirm you have the right one.
03Risk
04Undo
✓No undo needed — this command does not change persistent state.
05Sources
- PKILL(1) / pgrep — macOS man pageEvidence: The macOS man page for pgrep/pkill documents -l (long format, printing the process name next to the PID) and -f (match against full command line rather than just the process name).
- pgrep(1) man pageEvidence: The page documents pgrep's -l option ("Long output. For pgrep, print the process name in addition to the process ID for each matching process") and the -f flag for matching against the full argument list.
Last verified: 2026-09-19 · Category: System & Settings
06Related solutions
Point macOS screen captures at any folder you choose instead of the desktop.
Grab any file from the web straight into the current folder — no browser needed.
List the biggest files in your home folder that are eating disk space.