pgrep — find a process PID by name
cheat sheet · Ubuntu 24.04 · procps-ng 4.0.4 https://lab.dimsanych.ru/en/wiki/pgrep/Cheat sheet
-
pgrep nginxPIDs of processes with nginx in the name -
pgrep -l nginxPID and name -
pgrep -a nginxPID and the full command line -
pgrep -x sshdthe whole name, not a part -
pgrep -f 'app.py --dev'by the whole command line -
pgrep -u www-data -la user's processes -
pgrep -c -x nginxhow many there are -
pgrep -n python3the newest; -o the oldest -
pgrep -P 1234 -lchildren of process 1234 -
pidof cronPIDs by exact program name
Options
Selection options (-u, -P, -t, -x) combine with AND. Full list — man pgrep.