Where to start First steps track · 15 stages
Linux Labs

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 nginx PIDs of processes with nginx in the name
  • pgrep -l nginx PID and name
  • pgrep -a nginx PID and the full command line
  • pgrep -x sshd the whole name, not a part
  • pgrep -f 'app.py --dev' by the whole command line
  • pgrep -u www-data -l a user's processes
  • pgrep -c -x nginx how many there are
  • pgrep -n python3 the newest; -o the oldest
  • pgrep -P 1234 -l children of process 1234
  • pidof cron PIDs by exact program name

Options

Selection options (-u, -P, -t, -x) combine with AND. Full list — man pgrep.

Loading…