xref: /freebsd/usr.bin/killall/killall.1 (revision a970610a3af63b3f4df5b69d91c6b4093a00ed8f)
1.\" Copyright (C) 1995 by Joerg Wunsch, Dresden
2.\" All rights reserved.
3.\"
4.\" Redistribution and use in source and binary forms, with or without
5.\" modification, are permitted provided that the following conditions
6.\" are met:
7.\" 1. Redistributions of source code must retain the above copyright
8.\"    notice, this list of conditions and the following disclaimer.
9.\" 2. Redistributions in binary form must reproduce the above copyright
10.\"    notice, this list of conditions and the following disclaimer in the
11.\"    documentation and/or other materials provided with the distribution.
12.\"
13.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR(S) ``AS IS'' AND ANY EXPRESS
14.\" OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
15.\" WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
16.\" DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR(S) BE LIABLE FOR ANY DIRECT,
17.\" INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
18.\" (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
19.\" SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
20.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
21.\" STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
22.\" IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
23.\" POSSIBILITY OF SUCH DAMAGE.
24.\"
25.Dd June 27, 2020
26.Dt KILLALL 1
27.Os
28.Sh NAME
29.Nm killall
30.Nd kill processes by name
31.Sh SYNOPSIS
32.Nm
33.Op Fl delmsvz
34.Op Fl help
35.Op Fl I
36.Op Fl j Ar jail
37.Op Fl u Ar user
38.Op Fl t Ar tty
39.Op Fl c Ar procname
40.Op Fl Ar SIGNAL
41.Op Ar procname ...
42.Sh DESCRIPTION
43The
44.Nm
45utility kills processes selected by name, as opposed to the selection by PID
46as done by
47.Xr kill 1 .
48By default, it will send a
49.Dv TERM
50signal to all processes with a real UID identical to the
51caller of
52.Nm
53that match the name
54.Ar procname .
55The super-user is allowed to kill any process.
56.Pp
57The options are as follows:
58.Bl -tag -width ".Fl c Ar procname"
59.It Fl d
60Be more verbose about what will be done, but do not send any signal.
61The total number of user processes and the real user ID is shown.
62A list of the processes that will be sent the signal will be printed, or a
63message indicating that no matching processes have been found.
64.It Fl e
65Use the effective user ID instead of the (default) real user ID for matching
66processes specified with the
67.Fl u
68option.
69.It Fl help
70Give a help on the command usage and exit.
71.It Fl I
72Request confirmation before attempting to signal each
73process.
74.It Fl l
75List the names of the available signals and exit, like in
76.Xr kill 1 .
77.It Fl m
78Match the argument
79.Ar procname
80as a (case sensitive) regular expression against the names
81of processes found.
82CAUTION!
83This is dangerous, a single dot will match any process
84running under the real UID of the caller.
85.It Fl v
86Be verbose about what will be done.
87.It Fl s
88Same as
89.Fl v ,
90but do not send any signal.
91.It Fl Ar SIGNAL
92Send a different signal instead of the default
93.Dv TERM .
94The signal may be specified either as a name
95(with or without a leading
96.Dq Li SIG ) ,
97or numerically.
98.It Fl j Ar jail
99Kill processes in the specified
100.Ar jail .
101.It Fl u Ar user
102Limit potentially matching processes to those belonging to
103the specified
104.Ar user .
105.It Fl t Ar tty
106Limit potentially matching processes to those running on
107the specified
108.Ar tty .
109.It Fl c Ar procname
110Limit potentially matching processes to those matching
111the specified
112.Ar procname .
113.It Fl q
114Suppress error message if no processes are matched.
115.It Fl z
116Do not skip zombies.
117This should not have any effect except to print a few error messages
118if there are zombie processes that match the specified pattern.
119.El
120.Sh ALL PROCESSES
121Sending a signal to all processes with the given UID
122is already supported by
123.Xr kill 1 .
124So use
125.Xr kill 1
126for this job (e.g.\&
127.Dq Li "kill -TERM -1"
128or as root
129.Dq Li "echo kill -TERM -1 | su -m <user>" ) .
130.Sh IMPLEMENTATION NOTES
131This
132.Fx
133implementation of
134.Nm
135has completely different semantics as compared to the traditional
136.Ux
137System V behavior of
138.Nm .
139The latter will kill all processes that the current user is able to
140kill, and is intended to be used by the system shutdown process only.
141.Sh EXIT STATUS
142The
143.Nm
144utility exits 0 if some processes have been found and
145signalled successfully.
146Otherwise, a status of 1 will be
147returned.
148.Sh EXAMPLES
149Send
150.Dv SIGTERM
151to all firefox processes:
152.Bd -literal -offset indent
153killall firefox
154.Ed
155.Pp
156Send
157.Dv SIGTERM
158to firefox processes belonging to
159.Va USER :
160.Bd -literal -offset indent
161killall -u ${USER} firefox
162.Ed
163.Pp
164Stop all firefox processes:
165.Bd -literal -offset indent
166killall -SIGSTOP firefox
167.Ed
168.Pp
169Resume firefox processes:
170.Bd -literal -offset indent
171killall -SIGCONT firefox
172.Ed
173.Pp
174Show what would be done to firefox processes, but do not actually signal them:
175.Bd -literal -offset indent
176killall -s firefox
177.Ed
178.Pp
179Send
180.Dv SIGKILL
181to csh process running inside jail ID 282:
182.Bd -literal -offset indent
183killall -9 -j282 csh
184.Ed
185.Pp
186Send
187.Dv SIGTERM
188to all processes matching provided pattern (like vim and vimdiff):
189.Bd -literal -offset indent
190killall -m 'vim*'
191.Ed
192.Sh DIAGNOSTICS
193Diagnostic messages will only be printed if the
194.Fl d
195flag is used.
196.Sh SEE ALSO
197.Xr kill 1 ,
198.Xr pkill 1 ,
199.Xr sysctl 3 ,
200.Xr jail 8
201.Sh HISTORY
202The
203.Nm
204command appeared in
205.Fx 2.1 .
206It has been modeled after the
207.Nm
208command as available on other platforms.
209.Sh AUTHORS
210.An -nosplit
211The
212.Nm
213program was originally written in Perl and was contributed by
214.An Wolfram Schneider ,
215this manual page has been written by
216.An J\(:org Wunsch .
217The current version of
218.Nm
219was rewritten in C by
220.An Peter Wemm
221using
222.Xr sysctl 3 .
223