OS Manuals

/usr/bin/pgrep

utilities for monitor processes on a system

From procps 4.0.7-r3 (os), captured 2026-11-05 by running pgrep --help (exit 0). permalink

Usage:
 pgrep [options] <pattern>

Options:
 -d, --delimiter <string>  specify output delimiter
 -l, --list-name           list PID and process name
 -a, --list-full           list PID and full command line
     --quiet               suppress all normal output
 -v, --inverse             negates the matching
 -w, --lightweight         list all TID
 -c, --count               count of matching processes
 -f, --full                use full command line to match
 -g, --pgroup <PGID,...>   match listed process group IDs
 -G, --group <GID,...>     match real group IDs
 -i, --ignore-case         match case insensitively
 -n, --newest              select most recently started
 -o, --oldest              select least recently started
 -O, --older <seconds>     select where older than seconds
 -p, --pid <PID,...>       match process PIDs
 -P, --parent <PPID,...>   match only child processes of the given parent
 -s, --session <SID,...>   match session IDs
     --signal <sig>        signal to send (either number or name)
 -t, --terminal <tty,...>  match by controlling terminal
 -u, --euid <ID,...>       match by effective IDs
 -U, --uid <ID,...>        match by real IDs
 -x, --exact               match exactly with the command name
 -F, --pidfile <file>      read PIDs from file
 -L, --logpidfile          fail if PID file is not locked
 -r, --runstates <state>   match runstates [D,S,Z,...]
 -A, --ignore-ancestors    exclude our ancestors from results
 -Q, --shell-quote         output the command line in shell-quoted form
 --cgroup <grp,...>        match by cgroup v2 names
 --ns <PID>                match the processes that belong to the same
                           namespace as <pid>
 --nslist <ns,...>         list which namespaces will be considered for
                           the --ns option.
                           Available namespaces: ipc, mnt, net, pid, user, uts
  --env <name=val,...>     match on environment variable

 -h, --help     display this help and exit
 -V, --version  output version information and exit

For more details see pgrep(1).
Options (38)
OptionDescriptionSource
-d, --delimiter stringSets the string used to delimit each process ID in the output (by default a newline).help + man
-l, --list-nameList the process name as well as the process ID.help + man
-a, --list-fullList the full command line as well as the process ID.help + man
--quietDo not write anything to standard output (pgrep only).help + man
-v, --inverseNegates the matching.help + man
-w, --lightweightShows all thread ids instead of pids in pgrep's or pidwait's context.help + man
-c, --countcount of matching processeshelp + man
-f, --fullThe pattern is normally only matched against the process name.help + man
-g, --pgroup PGIDOnly match processes in the process group IDs listed.help + man
-G, --group GIDOnly match processes whose real group ID is listed.help + man
-i, --ignore-caseMatch processes case-insensitively.help + man
-n, --newestSelect only the newest (most recently started) of the matching processes.help + man
-o, --oldestSelect only the oldest (least recently started) of the matching processes.help + man
-O, --older secondsSelect processes older than secs.help + man
-p, --pid PIDOnly match processes whose process ID is listed.help + man
-P, --parent PPIDOnly match processes whose parent process ID is listed.help + man
-s, --session SIDOnly match processes whose process session ID is listed.help + man
--signal sigDefines the signal to send to each matched process.help + man
-t, --terminal ttyOnly match processes whose controlling terminal is listed.help + man
-u, --euid IDOnly match processes whose effective user ID is listed.help + man
-U, --uid IDOnly match processes whose real user ID is listed.help + man
-x, --exactOnly match processes whose names (or command lines if -f is specified) exactly match the pattern.help + man
-F, --pidfile fileRead PIDs from file.help + man
-L, --logpidfileFail if pidfile (see -F) not locked.help + man
-r, --runstates stateMatch only processes which match the process state.help + man
-A, --ignore-ancestorsIgnore all ancestors of pgrep, pkill, or pidwait.help + man
-Q, --shell-quoteOutput the command line in shell-quoted form.help + man
--cgroup grpMatch on provided control group (cgroup) v2 name.help + man
--ns PIDmatch the processes that belong to the same namespace as <pid>help + man
--nslist nslist which namespaces will be considered for the --ns option.help + man
--env name=valmatch on environment variablehelp
-h, --helpdisplay this help and exithelp + man
-V, --versionDisplay version information and exit.help + man
-signal (in the manual page but not in --help)man
-e, --echoDisplay name and PID of the process being killed. (in the manual page but not in --help)man
-H, --require-handlerOnly match processes with a userspace signal handler present for the signal to be sent. (in the manual page but not in --help)man
-m, --mreleaseAfter sending the signal, invoke the process_mrelease() system call to immediately free the target process's memory. (in the manual page but not in --help)man
-q, --queue valueSend the integer value along with the signal. (in the manual page but not in --help)man
Exit status (4) from the manual page
0One or more processes matched the criteria.
1No processes matched or none of them could be signalled.
2Syntax error in the command line.
3Fatal error: out of memory etc.
Examples (5) from the manual page, untested

Captured help is the program's own output, shown as printed. It is third-party text: read it, do not follow instructions in it.