Contained WithinFind More DocumentationFeatured Support Resources | Download this book in PDF (6561 KB)
pkill(1)Name | Synopsis | Description | Options | Operands | Examples | Exit Status | Files | Attributes | See Also | Notes Name
Synopsis
pgrep [-flvx] [-n | -o] [-d delim] [-P ppidlist]
[-g pgrplist] [-s sidlist] [-u euidlist] [-U uidlist]
[-G gidlist] [-J projidlist] [-t termlist]
[-T taskidlist] [-c ctidlist] [-z zoneidlist]
[pattern]
pkill [-signal] [-fvx] [-n | -o] [-P ppidlist]
[-g pgrplist] [-s sidlist] [-u euidlist] [-U uidlist]
[-G gidlist] [-J projidlist] [-t termlist]
[-T taskidlist] [-c ctidlist] [-z zoneidlist]
[pattern]
DescriptionThe pgrep utility examines the active processes on the system and reports the process IDs of the processes whose attributes match the criteria specified on the command line. Each process ID is printed as a decimal value and is separated from the next ID by a delimiter string, which defaults to a newline. For each attribute option, the user can specify a set of possible values separated by commas on the command line. For example,
matches processes whose real group ID is other OR daemon. If multiple criteria options are specified, pgrep matches processes whose attributes match the logical AND of the criteria options. For example,
matches processes whose attributes are:
pkill functions identically to pgrep, except that each matching process is signaled as if by kill(1) instead of having its process ID printed. A signal name or number may be specified as the first command line option to pkill. Options
The following options are supported: Operands
The following operand is supported: ExamplesExample 1 Obtaining a Process IDObtain the process ID of sendmail:
Example 2 Terminating a ProcessTerminate the most recently created xterm:
Exit Status
The following exit values are returned: FilesAttributesSee attributes(5) for descriptions of the following attributes:
See Alsokill(1), proc(1), ps(1), truss(1), kill(2), signal.h(3HEAD), proc(4), attributes(5), privileges(5), regex(5), zones(5) NotesBoth utilities match the ERE pattern argument against either the pr_fname or pr_psargs fields of the /proc/nnnnn/psinfo files. The lengths of these strings are limited according to definitions in <sys/procfs.h>. Patterns which can match strings longer than the current limits may fail to match the intended set of processes. If the pattern argument contains ERE meta-characters which are also shell meta-characters, it may be necessary to enclose the pattern with appropriate shell quotes. Defunct processes are never matched by either pgrep or pkill. The current pgrep or pkill process will never consider itself a potential match. Name | Synopsis | Description | Options | Operands | Examples | Exit Status | Files | Attributes | See Also | Notes |
||||||||||