| PKILL(1) | General Commands Manual | PKILL(1) |
pkill, pgrep,
prenice — find or signal
processes by name
pgrep |
[-fiLlnqvx] [-d
delim] [-F
pidfile] [-G
gid] [-g
pgrp] [-P
ppid] [-s
sid] [-t
tty] [-U
uid] [-u
euid] pattern ... |
pkill |
[-signal] [-fiLlnvx]
[-F pidfile]
[-G gid]
[-g pgrp]
[-P ppid]
[-s sid]
[-t tty]
[-U uid]
[-u euid]
pattern ... |
prenice |
[-l] priority
pattern ... |
The pgrep command searches the process
table on the running system and prints the process IDs of all processes that
match the criteria given on the command line.
The pkill command searches the process
table on the running system and signals all processes that match the
criteria given on the command line.
The prenice command searches the process
table on the running system and sets the priority of all processes that
match the criteria given on the command line.
By default, matching applies to any substring of the command name (argv[0]), but options may be used to change this. Patterns are specified using extended regular expressions (see re_format(7)).
The following options are available for
pkill and pgrep:
-d
delimpgrep command.-f-F
pidfile-G
gid-g
pgrppgrep
or pkill command.-i-L-F
option must be locked with the
flock(2) syscall or created
with
pidfile_lock(3).-l-f,
print the process ID and the full argument list for each matching
process.-n-P
ppid-s
sidpgrep or
pkill command.-t
tty-U
uid-u
euid-v-x-f is given. The default is to match any
substring.-signalpkill.The following option is also available for
pgrep:
-qThe -l flag is also available for
prenice.
Note that a running pgrep,
pkill, or prenice process
will never consider itself or system processes (kernel threads) as a
potential match.
The Sun Solaris implementation utilised procfs to obtain process information. This implementation utilises kvm(3) instead.
pgrep, pkill, and
prenice return one of the following values upon
exit:
grep(1), kill(1), ps(1), kill(2), sigaction(2), kvm(3), re_format(7), signal(7), renice(8)
pkill and pgrep
first appeared in NetBSD 1.6. They are modelled
after utilities of the same name that appeared in Sun Solaris 7.
prenice was introduced in
NetBSD 6.0.
Andrew Doran <ad@NetBSD.org>.
| October 6, 2024 | NetBSD 11.0 |