xref: /dragonfly/usr.bin/pkill/pkill.1 (revision e65bc1c3)
1.\"	$NetBSD: pkill.1,v 1.8 2003/02/14 15:59:18 grant Exp $
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.\" 3. All advertising materials mentioning features or use of this software
18.\"    must display the following acknowledgement:
19.\"        This product includes software developed by the NetBSD
20.\"        Foundation, Inc. and its contributors.
21.\" 4. Neither the name of The NetBSD Foundation nor the names of its
22.\"    contributors may be used to endorse or promote products derived
23.\"    from this software without specific prior written permission.
24.\"
25.\" THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
26.\" ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
27.\" TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
28.\" PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
29.\" BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
30.\" CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
31.\" SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
32.\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
33.\" CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
34.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
35.\" POSSIBILITY OF SUCH DAMAGE.
36.\"
37.Dd July 27, 2004
38.Dt PKILL 1
39.Os
40.Sh NAME
41.Nm pgrep ,
42.Nm pkill
43.Nd find or signal processes by name
44.Sh SYNOPSIS
45.Nm pgrep
46.Op Fl flnvx
47.Op Fl G Ar gid
48.Op Fl P Ar ppid
49.Op Fl U Ar uid
50.Op Fl d Ar delim
51.Op Fl g Ar pgrp
52.Op Fl s Ar sid
53.Op Fl t Ar tty
54.Op Fl u Ar euid
55.Op Fl j Ar jid
56.Op Ar pattern Op ...
57.Nm pkill
58.Op Fl signal
59.Op Fl fnvx
60.Op Fl G Ar gid
61.Op Fl P Ar ppid
62.Op Fl U Ar uid
63.Op Fl g Ar pgrp
64.Op Fl s Ar sid
65.Op Fl t Ar tty
66.Op Fl u Ar euid
67.Op Fl j Ar jid
68.Op Ar pattern Op ...
69.Sh DESCRIPTION
70The
71.Nm pgrep
72command searches the process table on the running system and prints the
73process IDs of all processes that match the criteria given on the command
74line.
75.Pp
76The
77.Nm pkill
78command searches the process table on the running system and signals all
79processes that match the criteria given on the command line.
80.Pp
81The following options are available:
82.Bl -tag -width xxxxxxxx
83.It Fl G Ar gid
84Restrict matches to processes with a real group ID in the comma-separated
85list
86.Ar gid .
87.It Fl P Ar ppid
88Restrict matches to processes with a parent process ID in the
89comma-separated list
90.Ar ppid .
91.It Fl U Ar uid
92Restrict matches to processes with a real user ID in the comma-separated
93list
94.Ar uid .
95.It Fl d Ar delim
96Specify a delimiter to be printed between each process ID.
97The default is a newline.
98This option can only be used with the
99.Nm pgrep
100command.
101.It Fl f
102Match against full argument lists.
103The default is to match against process names.
104.It Fl g Ar pgrp
105Restrict matches to processes with a process group ID in the comma-separated
106list
107.Ar pgrp .
108The value zero is taken to mean the process group ID of the running
109.Nm pgrep
110or
111.Nm pkill
112command.
113.It Fl j Ar jid
114Restrict matches to processes inside jails with a jail ID in the comma-separated
115list
116.Ar jid .
117The value
118.Dq Li -1
119matches processes in any jail.
120The value
121.Dq Li 0
122matches processes not in a jail.
123.It Fl l
124Long output.
125Print the process name in addition to the process ID for each matching
126process.
127If used in conjunction with
128.Fl f ,
129print the process ID and the full argument list for each matching process.
130This option can only be used with the
131.Nm pgrep
132command.
133.It Fl n
134Match only the most recently created process, if any.
135.It Fl s Ar sid
136Restrict matches to processes with a session ID in the comma-separated
137list
138.Ar sid .
139The value zero is taken to mean the session ID of the running
140.Nm pgrep
141or
142.Nm pkill
143command.
144.It Fl t Ar tty
145Restrict matches to processes associated with a terminal in the
146comma-separated list
147.Ar tty .
148Terminal names may be of the form
149.Sq ttyxx
150or the shortened form
151.Sq xx .
152A single dash (`-') matches processes not associated with a terminal.
153.It Fl u Ar euid
154Restrict matches to processes with an effective user ID in the
155comma-separated list
156.Ar euid .
157.It Fl v
158Reverse the sense of the matching; display processes that do not match the
159given criteria.
160.It Fl x
161Require an exact match of the process name, or argument list if
162.Fl f
163is given.
164The default is to match any substring.
165.It Fl signal
166A non-negative decimal number or symbolic signal name specifying the signal
167to be sent instead of the default TERM.
168This option is valid only when given as the first argument to
169.Nm pkill .
170.El
171.Pp
172Note that a running
173.Nm pgrep
174or
175.Nm pkill
176process will never consider itself nor system processes (kernel threads) as
177a potential match.
178.Sh DIAGNOSTICS
179.Nm pgrep
180and
181.Nm pkill
182return one of the following values upon exit:
183.Bl -tag -width foo
184.It 0
185One or more processes were matched.
186.It 1
187No processes were matched.
188.It 2
189Invalid options were specified on the command line.
190.It 3
191An internal error occurred.
192.El
193.Sh SEE ALSO
194.Xr kill 1 ,
195.Xr ps 1 ,
196.Xr kill 2 ,
197.Xr sigaction 2 ,
198.Xr signal 3 ,
199.Xr re_format 7
200.Sh HISTORY
201.Nm pkill
202and
203.Nm pgrep
204originated in
205.Nx 1.6 .
206They are modeled after utilities of the same name that appeared in Sun
207Solaris 7.
208They first appeared in
209.Dx
210in version 1.1.
211.Sh AUTHORS
212.An Andrew Doran Aq Mt ad@NetBSD.org
213