# info > pgrep

---
type: CommandReference
command: pgrep, pkill, pidwait
mode: man
section: 1
source: man-pages
---

## Quick Reference

- `pgrep -u root sshd` — List PIDs of processes named sshd owned by root
- `pgrep -u root,daemon` — List processes owned by root or daemon
- `pkill -HUP syslogd` — Send SIGHUP to syslogd
- `pgrep -f "pattern"` — Match against full command line
- `pgrep -x xterm` — Match exact process name
- `pkill -9 firefox` — Force kill processes named firefox
- `pgrep -c chrome` — Count matching processes
- `pidwait -u root` — Wait for all root-owned processes to exit

## Name

pgrep, pkill, pidwait — look up, signal, or wait for processes based on name and other attributes

## Synopsis

pgrep [options] pattern
pkill [options] pattern
pidwait [options] pattern
## Options

### General

- `-signal`, `--signal signal` — Signal to send (pkill only; default SIGTERM)
- `-c`, `--count` — Print count of matching processes (instead of normal output)
- `-d, --delimiter delimiter` — Delimiter for process IDs (pgrep only; default newline)
- `-e, --echo` — Display name and PID of killed process (pkill only)
- `-f, --full` — Match against full command line (not just process name)
- `-g, --pgroup pgrp,...` — Match processes in given process group IDs
- `-G, --group gid,...` — Match processes with real group ID
- `-i, --ignore-case` — Case-insensitive matching
- `-l, --list-name` — List process name and PID (pgrep only)
- `-a, --list-full` — List full command line and PID (pgrep only)
- `-n, --newest` — Select only the newest (most recently started) matching process
- `-o, --oldest` — Select only the oldest (least recently started) matching process
- `-O, --older secs` — Select processes older than secs
- `-P, --parent ppid,...` — Match processes with given parent PID
- `-s, --session sid,...` — Match processes with given session ID
- `-t, --terminal term,...` — Match processes with given controlling terminal (without "/dev/")
- `-u, --euid euid,...` — Match processes with effective user ID
- `-U, --uid uid,...` — Match processes with real user ID
- `-v, --inverse` — Negate matching (disabled in pkill's short form)
- `-w, --lightweight` — Show thread IDs instead of PIDs (pgrep/pidwait only)
- `-x, --exact` — Match exact process name (or command line with -f)
- `-F, --pidfile file` — Read PIDs from file (useful for pkill/pidwait)
- `-L, --logpidfile` — Fail if pidfile (from -F) is not locked
- `-r, --runstates D,R,S,Z,...` — Match processes by state
- `--ns pid` — Match processes in same namespaces (requires root)
- `--nslist name,...` — Limit namespaces to match (ipc, mnt, net, pid, user, uts)
- `-q, --queue value` — Use `sigqueue(3)` to send signal with integer value
- `-V, --version` — Display version and exit
- `-h, --help` — Display help and exit

## Examples

shell
$ pgrep -u root named
shell
$ pkill -HUP syslogd
shell
$ ps -fp $(pgrep -d, -x xterm)
shell
$ renice +4 $(pgrep chrome)
## Exit Codes

- `0` — One or more processes matched (and for pkill/pidwait, successfully signalled/wait)
- `1` — No processes matched or none could be signalled
- `2` — Syntax error in command line
- `3` — Fatal error (out of memory, etc.)

## See Also

- [ps(1)](https://www.chedong.com/phpMan.php/man/ps/1/markdown)
- [regex(7)](https://www.chedong.com/phpMan.php/man/regex/7/markdown)
- [signal(7)](https://www.chedong.com/phpMan.php/man/signal/7/markdown)
- [sigqueue(3)](https://www.chedong.com/phpMan.php/man/sigqueue/3/markdown)
- [killall(1)](https://www.chedong.com/phpMan.php/man/killall/1/markdown)
- [skill(1)](https://www.chedong.com/phpMan.php/man/skill/1/markdown)
- [kill(1)](https://www.chedong.com/phpMan.php/man/kill/1/markdown)
- [kill(2)](https://www.chedong.com/phpMan.php/man/kill/2/markdown)