Annotation of src/usr.bin/pkill/pkill.1, Revision 1.27
1.27 ! sevan 1: .\" $NetBSD: pkill.1,v 1.26 2013/11/01 07:49:00 apb Exp $
1.1 ad 2: .\"
3: .\" Copyright (c) 2002 The NetBSD Foundation, Inc.
4: .\" All rights reserved.
5: .\"
6: .\" This code is derived from software contributed to The NetBSD Foundation
7: .\" by Andrew Doran.
8: .\"
9: .\" Redistribution and use in source and binary forms, with or without
10: .\" modification, are permitted provided that the following conditions
11: .\" are met:
12: .\" 1. Redistributions of source code must retain the above copyright
13: .\" notice, this list of conditions and the following disclaimer.
14: .\" 2. Redistributions in binary form must reproduce the above copyright
15: .\" notice, this list of conditions and the following disclaimer in the
16: .\" documentation and/or other materials provided with the distribution.
17: .\"
18: .\" THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
19: .\" ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
20: .\" TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
21: .\" PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
22: .\" BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
23: .\" CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
24: .\" SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
25: .\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
26: .\" CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
27: .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
28: .\" POSSIBILITY OF SUCH DAMAGE.
29: .\"
1.27 ! sevan 30: .Dd August 22, 2016
1.1 ad 31: .Dt PKILL 1
32: .Os
33: .Sh NAME
34: .Nm pkill
35: .Nd find or signal processes by name
36: .Sh SYNOPSIS
37: .Nm pgrep
1.9 sketch 38: .Op Fl filnvx
1.11 wiz 39: .Op Fl d Ar delim
1.1 ad 40: .Op Fl G Ar gid
1.11 wiz 41: .Op Fl g Ar pgrp
1.1 ad 42: .Op Fl P Ar ppid
43: .Op Fl s Ar sid
44: .Op Fl t Ar tty
1.11 wiz 45: .Op Fl U Ar uid
1.1 ad 46: .Op Fl u Ar euid
1.23 enami 47: .Ar pattern ...
1.1 ad 48: .Nm pkill
49: .Op Fl signal
1.23 enami 50: .Op Fl filnvx
1.1 ad 51: .Op Fl G Ar gid
1.11 wiz 52: .Op Fl g Ar pgrp
1.1 ad 53: .Op Fl P Ar ppid
54: .Op Fl s Ar sid
55: .Op Fl t Ar tty
1.11 wiz 56: .Op Fl U Ar uid
1.1 ad 57: .Op Fl u Ar euid
1.23 enami 58: .Ar pattern ...
1.19 mrg 59: .Nm prenice
1.21 mrg 60: .Op Fl l
1.23 enami 61: .Ar priority
62: .Ar pattern ...
1.1 ad 63: .Sh DESCRIPTION
64: The
65: .Nm pgrep
66: command searches the process table on the running system and prints the
67: process IDs of all processes that match the criteria given on the command
68: line.
69: .Pp
70: The
71: .Nm pkill
72: command searches the process table on the running system and signals all
73: processes that match the criteria given on the command line.
74: .Pp
1.19 mrg 75: The
76: .Nm prenice
77: command searches the process table on the running system and sets the
78: priority of all processes that match the criteria given on the command line.
79: .Pp
1.26 apb 80: By default, matching applies to any substring of the command name
81: .Pq Va argv[0] ,
82: but options may be used to change this.
83: Patterns are specified using extended regular expressions (see
84: .Xr re_format 7 ) .
85: .Pp
1.19 mrg 86: The following options are available for
87: .Nm pkill
88: and
1.22 wiz 89: .Nm pgrep :
1.3 ad 90: .Bl -tag -width xxxxxxxx
1.1 ad 91: .It Fl d Ar delim
92: Specify a delimiter to be printed between each process ID.
93: The default is a newline.
94: This option can only be used with the
95: .Nm pgrep
96: command.
97: .It Fl f
98: Match against full argument lists.
99: The default is to match against process names.
1.11 wiz 100: .It Fl G Ar gid
101: Restrict matches to processes with a real group ID in the comma-separated
102: list
103: .Ar gid .
1.1 ad 104: .It Fl g Ar pgrp
1.2 wiz 105: Restrict matches to processes with a process group ID in the comma-separated
1.1 ad 106: list
107: .Ar pgrp .
108: The value zero is taken to mean the process group ID of the running
109: .Nm pgrep
110: or
111: .Nm pkill
112: command.
1.9 sketch 113: .It Fl i
114: Ignore case distinctions in both the process table and the supplied pattern.
1.1 ad 115: .It Fl l
116: Long output.
117: Print the process name in addition to the process ID for each matching
118: process.
119: If used in conjunction with
120: .Fl f ,
121: print the process ID and the full argument list for each matching process.
122: .It Fl n
123: Match only the most recently created process, if any.
1.11 wiz 124: .It Fl P Ar ppid
125: Restrict matches to processes with a parent process ID in the
126: comma-separated list
127: .Ar ppid .
1.1 ad 128: .It Fl s Ar sid
1.2 wiz 129: Restrict matches to processes with a session ID in the comma-separated
1.1 ad 130: list
131: .Ar sid .
132: The value zero is taken to mean the session ID of the running
133: .Nm pgrep
134: or
135: .Nm pkill
136: command.
137: .It Fl t Ar tty
138: Restrict matches to processes associated with a terminal in the
1.2 wiz 139: comma-separated list
1.1 ad 140: .Ar tty .
1.17 christos 141: Terminal names may be specified as a fully qualified path, in the form
142: .Sq ttyXX ,
143: or
144: .Sq pts/N ,
145: (where
1.18 wiz 146: .Ar XX
147: is any pair of letters, and
1.17 christos 148: .Ar N
149: is a number),
1.18 wiz 150: or the shortened forms
151: .Sq XX
152: or
1.17 christos 153: .Sq N .
1.12 wiz 154: A single dash
155: .Pq Sq -
156: matches processes not associated with a terminal.
1.11 wiz 157: .It Fl U Ar uid
158: Restrict matches to processes with a real user ID in the comma-separated
159: list
160: .Ar uid .
1.1 ad 161: .It Fl u Ar euid
162: Restrict matches to processes with an effective user ID in the
1.2 wiz 163: comma-separated list
1.1 ad 164: .Ar euid .
165: .It Fl v
166: Reverse the sense of the matching; display processes that do not match the
167: given criteria.
168: .It Fl x
1.2 wiz 169: Require an exact match of the process name, or argument list if
170: .Fl f
171: is given.
1.1 ad 172: The default is to match any substring.
173: .It Fl signal
174: A non-negative decimal number or symbolic signal name specifying the signal
175: to be sent instead of the default TERM.
176: This option is valid only when given as the first argument to
177: .Nm pkill .
178: .El
179: .Pp
1.22 wiz 180: The
181: .Fl l
1.24 dholland 182: flag is also available for
1.22 wiz 183: .Nm prenice .
184: .Pp
1.1 ad 185: Note that a running
1.25 wiz 186: .Nm pgrep ,
187: .Nm pkill ,
1.1 ad 188: or
1.24 dholland 189: .Nm prenice
1.12 wiz 190: process will never consider itself or system processes (kernel threads) as
1.7 ad 191: a potential match.
1.1 ad 192: .Sh EXIT STATUS
1.19 mrg 193: .Nm pgrep ,
1.20 wiz 194: .Nm pkill ,
1.1 ad 195: and
1.19 mrg 196: .Nm prenice
1.1 ad 197: return one of the following values upon exit:
198: .Bl -tag -width foo
199: .It 0
200: One or more processes were matched.
201: .It 1
202: No processes were matched.
203: .It 2
204: Invalid options were specified on the command line.
205: .It 3
206: An internal error occurred.
207: .El
208: .Sh SEE ALSO
1.13 jmmv 209: .Xr grep 1 ,
1.1 ad 210: .Xr kill 1 ,
211: .Xr ps 1 ,
212: .Xr kill 2 ,
213: .Xr sigaction 2 ,
214: .Xr re_format 7 ,
1.20 wiz 215: .Xr signal 7 ,
216: .Xr renice 8
1.4 jdolecek 217: .Sh HISTORY
218: .Nm pkill
219: and
220: .Nm pgrep
1.5 ad 221: first appeared in
1.4 jdolecek 222: .Nx 1.6 .
1.5 ad 223: They are modelled after utilities of the same name that appeared in Sun
1.6 ad 224: Solaris 7.
1.19 mrg 225: .Pp
226: .Nm prenice
227: was introduced in
228: .Nx 6.0 .
1.27 ! sevan 229: .Sh AUTHORS
! 230: .An Andrew Doran
! 231: .Aq Mt ad@NetBSD.org .
CVSweb <webmaster@jp.NetBSD.org>