PGREP(1) General Commands Manual PGREP(1) pgrep, pkill, pidwait - pgrep [option ...] pattern pkill [option ...] pattern pidwait [option ...] pattern pgrep ID $ pgrep -u root sshd will only list the processes whose name include sshd AND owned by root. On the other hand, $ pgrep -u root,daemon root daemon pkill SIGTERM pidwait - --signal pgrep pidwait --require-handler -c, --count count pkill pidwait -d, --delimiter ID pgrep -e, --echo PID pkill -f, --full -f -g, --pgroup pgrp,... ID 0 pgreppkill pidwait -G, --group gid,... ID -i, --ignore-case -l, --list-name ID pgrep -a, --list-full ID pgrep -n, --newest -o, --oldest -O, --older -P, --parent ppid,... ID -s, --session sid,... ID ID 0 pgreppkill pidwait ID -t, --terminal term,... "/dev/" -u, --euid euid,... ID -U, --uid uid,... ID -v, --inverse pgrep pidwait pkill -w, --lightweight pgrep pidwait id pid pkill -x, --exact -f -F, --pidfile Read PIDs from file. This option is more useful for pkill or pidwait than pgrep. The filename "-" can be used to read from STDIN. -L, --logpidfile pidfile -F -r, --runstates D,R,S,Z,... -A, --ignore-ancestors pgreppkill pidwait sudo -H, --require-handler --cgroup name,... (cgroup) v2 cgroups(8) --env name[=value],... Match on process that have these environment variables. If the =value parameter is not defined then only the variable name is matched. --ns pid root --nslist --nslist name,... ipcmntnetpiduseruts -q, --queue sigqueue(3) kill(2) sigaction(2) SA_SIGINFO siginfo_t si_value -V, --version -h, --help 1 named ID $ pgrep -u root named 2 syslog $ pkill -HUP syslogd 3 xterm $ ps -fp $(pgrep -d, -x xterm) 4 chrome nice $ renice +4 $(pgrep chrome) Example 5: Wait for a process with a known PID to finish: $ echo ${PID} | pidwait -F - 0 pkill pidwait 1 2 3 15 /proc/pid/stat -f /proc/pid/cmdline pgreppkill pidwait /proc subset=pid -O --older -n -o -v pidwait pidfd_open(2) Linux 5.3 ps(1), regex(7), signal(7), sigqueue(3), killall(1), skill(1), kill(1), kill(2), cgroups(8). Kjetil Torgrim Homme Please send bug reports to . procps-ng 2024-02-05 PGREP(1)