2025-03-14 21:59:59 -06:00
|
|
|
# pgrep
|
|
|
|
|
|
2026-06-12 17:51:25 -06:00
|
|
|
> Find processes by name.
|
|
|
|
|
> More information: <https://keith.github.io/xcode-man-pages/pgrep.1.html>.
|
2025-03-14 21:59:59 -06:00
|
|
|
|
|
|
|
|
- Return PIDs of any running processes with a matching command string:
|
|
|
|
|
|
|
|
|
|
`pgrep {{process_name}}`
|
|
|
|
|
|
2026-06-12 17:51:25 -06:00
|
|
|
- Print the process name in addition to the PID ([l]ong output):
|
2025-03-14 21:59:59 -06:00
|
|
|
|
2026-06-12 17:51:25 -06:00
|
|
|
`pgrep -l {{process_name}}`
|
2025-03-14 21:59:59 -06:00
|
|
|
|
2026-06-12 17:51:25 -06:00
|
|
|
- Match processes against the [f]ull argument list instead of just the process name:
|
2025-03-14 21:59:59 -06:00
|
|
|
|
2026-06-12 17:51:25 -06:00
|
|
|
`pgrep -f "{{process_name}} {{parameter}}"`
|
|
|
|
|
|
|
|
|
|
- Print the PID together with the [f]ull argument [l]ist for each match:
|
|
|
|
|
|
|
|
|
|
`pgrep -fl "{{process_name}}"`
|
|
|
|
|
|
|
|
|
|
- Search for processes run by a specific [u]ser (effective UID):
|
|
|
|
|
|
|
|
|
|
`pgrep -u {{username}} {{process_name}}`
|
|
|
|
|
|
|
|
|
|
- Select only the [n]ewest (most recently started) matching process:
|
|
|
|
|
|
|
|
|
|
`pgrep -n {{process_name}}`
|