2006-12-06 17:25:32 -06:00
|
|
|
.\" Copyright 1994 Salvatore Valente (svalente@mit.edu)
|
|
|
|
.\" Copyright 1992 Rickard E. Faith (faith@cs.unc.edu)
|
|
|
|
.\" May be distributed under the GNU General Public License
|
2019-11-25 14:31:20 -06:00
|
|
|
.TH KILL 1 "November 2019" "util-linux" "User Commands"
|
2006-12-06 17:25:32 -06:00
|
|
|
.SH NAME
|
|
|
|
kill \- terminate a process
|
|
|
|
.SH SYNOPSIS
|
2009-07-22 04:29:04 -05:00
|
|
|
.B kill
|
2014-07-09 08:29:10 -05:00
|
|
|
.RB [ \- \fIsignal\fR| \-s
|
2019-12-15 18:51:57 -06:00
|
|
|
.IR signal | \fB\-p\fP ]
|
2011-02-28 10:15:40 -06:00
|
|
|
.RB [ \-q
|
2014-07-09 08:29:10 -05:00
|
|
|
.IR value ]
|
2011-03-06 03:02:25 -06:00
|
|
|
.RB [ \-a ]
|
2019-11-25 14:31:20 -06:00
|
|
|
\fR[\fB\-\-timeout \fImilliseconds signal\fR]
|
2009-07-22 04:29:04 -05:00
|
|
|
.RB [ \-\- ]
|
2014-07-09 08:29:10 -05:00
|
|
|
.IR pid | name ...
|
2006-12-06 17:25:32 -06:00
|
|
|
.br
|
2014-07-09 08:29:10 -05:00
|
|
|
.B kill \-l
|
|
|
|
.RI [ number ]
|
|
|
|
.RB "| " \-L
|
2006-12-06 17:25:32 -06:00
|
|
|
.SH DESCRIPTION
|
2006-12-06 17:25:46 -06:00
|
|
|
The command
|
2006-12-06 17:25:32 -06:00
|
|
|
.B kill
|
2014-07-09 08:29:10 -05:00
|
|
|
sends the specified \fIsignal\fR to the specified processes or process groups.
|
2016-12-05 03:24:54 -06:00
|
|
|
.PP
|
|
|
|
If no signal is specified, the TERM signal is sent.
|
|
|
|
The default action for this signal is to terminate the process.
|
|
|
|
This signal should be used in preference to the
|
|
|
|
KILL signal (number 9), since a process may install a handler for the
|
|
|
|
TERM signal in order to perform clean-up steps before terminating in
|
|
|
|
an orderly fashion.
|
|
|
|
If a process does not terminate after a TERM signal has been sent,
|
|
|
|
then the KILL signal may be used; be aware that the latter signal
|
|
|
|
cannot be caught, and so does not give the target process the opportunity
|
2016-12-07 07:04:17 -06:00
|
|
|
to perform any clean-up before terminating.
|
2006-12-06 17:25:46 -06:00
|
|
|
.PP
|
2020-05-25 07:59:08 -05:00
|
|
|
Most modern shells have a builtin
|
|
|
|
.B kill
|
|
|
|
command, with a usage rather similar to
|
2014-07-09 08:29:10 -05:00
|
|
|
that of the command described here. The
|
|
|
|
.BR \-\-all ,
|
|
|
|
.BR \-\-pid ", and"
|
2018-05-18 14:21:42 -05:00
|
|
|
.B \-\-queue
|
2014-07-09 08:29:10 -05:00
|
|
|
options, and the possibility to specify processes by command name, are local extensions.
|
2008-01-28 08:17:45 -06:00
|
|
|
.PP
|
2014-07-09 08:29:10 -05:00
|
|
|
If \fIsignal\fR is 0, then no actual signal is sent, but error checking is still performed.
|
|
|
|
|
|
|
|
.SH ARGUMENTS
|
2016-12-04 13:44:04 -06:00
|
|
|
The list of processes to be signaled can be a mixture of names and PIDs.
|
2006-12-06 17:25:32 -06:00
|
|
|
.TP
|
2014-07-09 08:29:10 -05:00
|
|
|
.I pid
|
|
|
|
Each
|
2006-12-06 17:25:32 -06:00
|
|
|
.I pid
|
2020-05-25 07:59:08 -05:00
|
|
|
can be expressed in one of the following ways:
|
2006-12-06 17:25:46 -06:00
|
|
|
.RS
|
|
|
|
.TP
|
2006-12-06 17:25:34 -06:00
|
|
|
.I n
|
|
|
|
where
|
|
|
|
.I n
|
2016-12-04 13:44:04 -06:00
|
|
|
is larger than 0. The process with PID
|
2006-12-06 17:25:34 -06:00
|
|
|
.I n
|
2014-07-09 08:29:10 -05:00
|
|
|
is signaled.
|
2006-12-06 17:25:46 -06:00
|
|
|
.TP
|
|
|
|
.B 0
|
|
|
|
All processes in the current process group are signaled.
|
|
|
|
.TP
|
2019-12-15 18:51:57 -06:00
|
|
|
.B \-1
|
2016-12-04 13:44:04 -06:00
|
|
|
All processes with a PID larger than 1 are signaled.
|
2006-12-06 17:25:46 -06:00
|
|
|
.TP
|
2019-12-15 18:51:57 -06:00
|
|
|
.BI \- n
|
2009-07-22 04:29:04 -05:00
|
|
|
where
|
|
|
|
.I n
|
2013-03-07 17:05:48 -06:00
|
|
|
is larger than 1. All processes in process group
|
2006-12-06 17:25:34 -06:00
|
|
|
.I n
|
2019-12-15 18:51:57 -06:00
|
|
|
are signaled. When an argument of the form '\-n' is given, and it is meant to
|
2014-07-09 08:29:10 -05:00
|
|
|
denote a process group, either a signal must be specified first, or the
|
2019-12-15 18:51:57 -06:00
|
|
|
argument must be preceded by a '\-\-' option, otherwise it will be taken as the
|
2013-03-07 17:05:48 -06:00
|
|
|
signal to send.
|
2014-04-07 04:22:12 -05:00
|
|
|
.RE
|
2006-12-06 17:25:46 -06:00
|
|
|
.TP
|
2014-04-07 04:22:12 -05:00
|
|
|
.I name
|
2014-07-09 08:29:10 -05:00
|
|
|
All processes invoked using this \fIname\fR will be signaled.
|
|
|
|
|
|
|
|
.SH OPTIONS
|
2006-12-06 17:25:32 -06:00
|
|
|
.TP
|
2013-03-07 17:05:48 -06:00
|
|
|
\fB\-s\fR, \fB\-\-signal\fR \fIsignal\fR
|
2014-07-09 08:29:10 -05:00
|
|
|
The signal to send. It may be given as a name or a number.
|
2006-12-06 17:25:32 -06:00
|
|
|
.TP
|
2014-07-09 08:29:10 -05:00
|
|
|
\fB\-l\fR, \fB\-\-list\fR [\fInumber\fR]
|
|
|
|
Print a list of signal names, or convert the given signal number to a name.
|
|
|
|
The signals can be found in
|
2020-05-25 07:59:08 -05:00
|
|
|
.IR /usr/\:include/\:linux/\:signal.h .
|
2006-12-06 17:25:46 -06:00
|
|
|
.TP
|
2013-03-12 16:18:13 -05:00
|
|
|
\fB\-L\fR, \fB\-\-table\fR
|
2014-07-09 08:29:10 -05:00
|
|
|
Similar to \fB\-l\fR, but it will print signal names and their corresponding
|
2013-03-12 16:18:13 -05:00
|
|
|
numbers.
|
|
|
|
.TP
|
2013-03-07 17:05:48 -06:00
|
|
|
\fB\-a\fR, \fB\-\-all\fR
|
2016-12-04 13:44:04 -06:00
|
|
|
Do not restrict the command-name-to-PID conversion to processes with the same
|
2016-12-04 13:51:32 -06:00
|
|
|
UID as the present process.
|
2006-12-06 17:25:46 -06:00
|
|
|
.TP
|
2013-03-07 17:05:48 -06:00
|
|
|
\fB\-p\fR, \fB\-\-pid\fR
|
2016-12-04 13:44:04 -06:00
|
|
|
Only print the process ID (PID) of the named processes, do not send any
|
2013-03-07 17:05:48 -06:00
|
|
|
signals.
|
2011-02-28 10:15:40 -06:00
|
|
|
.TP
|
2015-07-02 22:41:04 -05:00
|
|
|
\fB\-\-verbose\fR
|
2020-05-25 07:59:08 -05:00
|
|
|
Print PID(s) that will be signaled with
|
|
|
|
.B kill
|
|
|
|
along with the signal.
|
2015-07-02 22:41:04 -05:00
|
|
|
.TP
|
2014-07-09 08:29:10 -05:00
|
|
|
\fB\-q\fR, \fB\-\-queue\fR \fIvalue\fR
|
2020-05-25 07:59:08 -05:00
|
|
|
Send the signal using
|
2016-12-03 13:37:51 -06:00
|
|
|
.BR sigqueue (3)
|
2011-02-28 10:15:40 -06:00
|
|
|
rather than
|
2014-07-09 08:29:10 -05:00
|
|
|
.BR kill (2).
|
|
|
|
The
|
|
|
|
.I value
|
|
|
|
argument is an integer that is sent along with the signal. If the
|
2016-12-05 03:43:53 -06:00
|
|
|
receiving process has installed a handler for this signal using the
|
|
|
|
.B SA_SIGINFO
|
2013-03-07 17:05:48 -06:00
|
|
|
flag to
|
2011-02-28 10:15:40 -06:00
|
|
|
.BR sigaction (2),
|
2016-12-05 03:43:53 -06:00
|
|
|
then it can obtain this data via the
|
|
|
|
.I si_sigval
|
|
|
|
field of the
|
|
|
|
.I siginfo_t
|
|
|
|
structure.
|
2019-11-25 14:31:20 -06:00
|
|
|
.TP
|
|
|
|
\fB\-\-timeout\fR \fImilliseconds signal\fR
|
2020-05-25 07:59:09 -05:00
|
|
|
Send a signal defined in the usual way to a process,
|
|
|
|
followed by an additional signal after a specified delay.
|
|
|
|
The
|
2019-11-25 14:31:20 -06:00
|
|
|
.B \-\-timeout
|
2020-05-25 07:59:09 -05:00
|
|
|
option causes
|
2019-11-25 14:31:20 -06:00
|
|
|
.B kill
|
|
|
|
to wait for a period defined in
|
|
|
|
.I milliseconds
|
2020-05-25 07:59:09 -05:00
|
|
|
before sending a follow-up
|
2019-11-25 14:31:20 -06:00
|
|
|
.I signal
|
2020-05-25 07:59:09 -05:00
|
|
|
to the process.
|
|
|
|
This feature is implemented using the Linux kernel
|
|
|
|
PID file descriptor feature in order to guarantee that the follow-up signal
|
|
|
|
is sent to the same process or not sent if the process no longer exists.
|
|
|
|
.IP
|
|
|
|
Note that the operating system may re-use PIDs and implementing an
|
|
|
|
equivalent feature in a shell using
|
|
|
|
.B kill
|
|
|
|
and
|
|
|
|
.B sleep
|
|
|
|
would be subject to races whereby the follow-up signal might be sent
|
|
|
|
to a different process that used a recycled PID.
|
|
|
|
.IP
|
|
|
|
The
|
|
|
|
.B \-\-timeout
|
|
|
|
option can be specified multiple times: the signals are sent
|
|
|
|
sequentially with the specified timeouts. The
|
2019-11-25 14:31:20 -06:00
|
|
|
.B \-\-timeout
|
2020-05-25 07:59:09 -05:00
|
|
|
option can be combined with the
|
2019-11-25 14:31:20 -06:00
|
|
|
.B \-\-queue
|
|
|
|
option.
|
|
|
|
.IP
|
2020-05-25 07:59:09 -05:00
|
|
|
As an example, the following command sends
|
|
|
|
the signals QUIT, TERM and KILL in sequence and waits for 1000
|
|
|
|
milliseconds between sending the signals:
|
|
|
|
.IP
|
|
|
|
.in +4n
|
doc: Fix some warnings from "test-groff" for manuals
Source is current git content.
Output is from: test-groff -b -e -mandoc -T utf8 -rF0 -t -w w -z
[ "test-groff" is a developmental version of "groff" ]
Input file is ././disk-utils/sfdisk.8
troff: backtrace: file '<./disk-utils/sfdisk.8>':67
troff: <./disk-utils/sfdisk.8>:67: warning: trailing space
Input file is ././misc-utils/kill.1
troff: backtrace: '/home/bg/git/groff/build/s-tmac/an-ext.tmac':133: macro 'EE'
troff: backtrace: file '<./misc-utils/kill.1>':167
troff: <./misc-utils/kill.1>:167: warning: macro 'mF' not defined
troff: backtrace: '/home/bg/git/groff/build/s-tmac/an-ext.tmac':134: macro 'EE'
troff: backtrace: file '<./misc-utils/kill.1>':167
troff: <./misc-utils/kill.1>:167: warning: number register 'mE' not defined
troff: backtrace: '/home/bg/git/groff/build/s-tmac/an-ext.tmac':134: macro 'EE'
troff: backtrace: file '<./misc-utils/kill.1>':167
troff: <./misc-utils/kill.1>:167: warning: bad font number
troff: backtrace: '/home/bg/git/groff/build/s-tmac/an-ext.tmac':135: macro 'EE'
troff: backtrace: file '<./misc-utils/kill.1>':167
troff: <./misc-utils/kill.1>:167: warning: number register 'sP' not defined
troff: backtrace: '/home/bg/git/groff/build/s-tmac/an-ext.tmac':134: macro 'EE'
troff: backtrace: file '<./misc-utils/kill.1>':170
troff: <./misc-utils/kill.1>:170: warning: bad font number
Input file is ././sys-utils/ipcs.1
<./sys-utils/ipcs.1>:103 (macro BR): only 1 argument, but more are expected
Input file is ././sys-utils/mount.8
<./sys-utils/mount.8>:68 (macro RB): only 1 argument, but more are expected
troff: backtrace: '/home/bg/git/groff/build/s-tmac/an-old.tmac':467: macro 'RB'
troff: backtrace: file '<./sys-utils/mount.8>':68
troff: <./sys-utils/mount.8>:68: warning [p 1, 3.5i]: can't break line
an-old.tmac: <./sys-utils/mount.8>:201 (.RE): warning: extra .RE or .RS is missing before it; "an-RS-open" is 0.
<./sys-utils/mount.8>:453 (macro BR): only 1 argument, but more are expected
<./sys-utils/mount.8>:500 (macro BR): only 1 argument, but more are expected
<./sys-utils/mount.8>:1050 (macro BR): only 1 argument, but more are expected
Input file is ././sys-utils/setpriv.1
<./sys-utils/setpriv.1>:17 (macro BR): only 1 argument, but more are expected
<./sys-utils/setpriv.1>:154 (macro BR): only 1 argument, but more are expected
<./sys-utils/setpriv.1>:166 (macro BR): only 1 argument, but more are expected
Input file is ././sys-utils/umount.8
<./sys-utils/umount.8>:145 (macro IR): only 1 argument, but more are expected
Input file is ././sys-utils/unshare.1
<./sys-utils/unshare.1>:266 (macro BR): only 1 argument, but more are expected
[kzak@redhat.com: - add .RS to fix extra .RE in mount.8]
Signed-off-by: Bjarni Ingi Gislason <bjarniig@rhi.hi.is>
Signed-off-by: Karel Zak <kzak@redhat.com>
2020-06-09 21:17:50 -05:00
|
|
|
.EX
|
2020-05-25 07:59:09 -05:00
|
|
|
kill \-\-verbose \-\-timeout 1000 TERM \-\-timeout 1000 KILL \e
|
|
|
|
\-\-signal QUIT 12345
|
|
|
|
.EE
|
|
|
|
.in
|
Manual pages: order NOTES / HISTORY / BUGS / EXAMPLE consistently
There is value in ensuring that manual page sections use consistently
named sections, as far as possible, and also that sections have a
consistent order within manual pages. This is one of a series of patches
to place manual page sections in a consistent order.
In this patch, we ensure that the NOTES, HISTORY, BUGS, and EXAMPLE
sections are always placed near the end of the page, just above
AUTHORS, COPYRIGHT, SEE ALSO, and AVAILABILITY.
One page is not fixed by this patch: term-utils/agetty.8. This page
is a mess of unusual section names, and probably requires an individual
edit.
Testing that no gross editing mistake (causing accidental loss or addition
of text) was performed as follows:
$ cat $(grep '\.SH' -l $(find . -name '*.[1-9]') |sort) | sort > a
[Apply patch]
$ cat $(grep '\.SH' -l $(find . -name '*.[1-9]') |sort) | sort > b
$ diff a b
$ echo $?
0
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-05-21 02:28:32 -05:00
|
|
|
.SH EXIT STATUS
|
|
|
|
.B kill
|
|
|
|
has the following exit status values:
|
|
|
|
.PP
|
|
|
|
.RS
|
|
|
|
.PD 0
|
|
|
|
.TP
|
|
|
|
.B 0
|
|
|
|
success
|
|
|
|
.TP
|
|
|
|
.B 1
|
|
|
|
failure
|
|
|
|
.TP
|
|
|
|
.B 64
|
|
|
|
partial success (when more than one process specified)
|
|
|
|
.PD
|
|
|
|
.RE
|
2013-01-15 04:14:03 -06:00
|
|
|
.SH NOTES
|
2016-12-05 03:38:53 -06:00
|
|
|
Although it is possible to specify the TID (thread ID, see
|
2013-01-15 04:14:03 -06:00
|
|
|
.BR gettid (2))
|
2016-12-05 03:38:53 -06:00
|
|
|
of one of the threads in a multithreaded process as the argument of
|
|
|
|
.BR kill ,
|
|
|
|
the signal is nevertheless directed to the process
|
|
|
|
(i.e., the entire thread group).
|
|
|
|
In other words, it is not possible to send a signal to an
|
|
|
|
explicitly selected thread in a multithreaded process.
|
|
|
|
The signal will be delivered to an arbitrarily selected thread
|
|
|
|
in the target process that is not blocking the signal.
|
|
|
|
For more details, see
|
|
|
|
.BR signal (7)
|
|
|
|
and the description of
|
2018-05-18 14:21:42 -05:00
|
|
|
.B CLONE_THREAD
|
2016-12-05 03:38:53 -06:00
|
|
|
in
|
|
|
|
.BR clone (2).
|
2020-03-22 04:37:41 -05:00
|
|
|
.P
|
2020-05-25 07:59:08 -05:00
|
|
|
Various shells provide a builtin
|
|
|
|
.B kill
|
|
|
|
command that is
|
2020-03-22 04:37:41 -05:00
|
|
|
preferred in relation to the
|
|
|
|
.BR kill (1)
|
2020-05-25 07:59:08 -05:00
|
|
|
executable described by this manual.
|
|
|
|
The easiest way to ensure one is executing the command described in this page
|
|
|
|
is to use the full path when calling the command, for example:
|
2020-05-14 18:51:29 -05:00
|
|
|
.B "/bin/kill \-\-version"
|
2014-04-07 04:12:14 -05:00
|
|
|
.SH AUTHORS
|
2013-03-07 17:05:48 -06:00
|
|
|
.MT svalente@mit.edu
|
|
|
|
Salvatore Valente
|
2014-04-07 04:12:14 -05:00
|
|
|
.ME
|
|
|
|
.br
|
|
|
|
.MT kzak@redhat.com
|
|
|
|
Karel Zak
|
|
|
|
.ME
|
|
|
|
.br
|
|
|
|
.PP
|
|
|
|
The original version was taken from BSD 4.4.
|
|
|
|
|
2020-05-21 02:28:21 -05:00
|
|
|
.SH SEE ALSO
|
|
|
|
.BR bash (1),
|
|
|
|
.BR tcsh (1),
|
|
|
|
.BR sigaction (2),
|
|
|
|
.BR kill (2),
|
|
|
|
.BR sigqueue (3),
|
|
|
|
.BR signal (7)
|
|
|
|
|
2007-07-02 18:17:04 -05:00
|
|
|
.SH AVAILABILITY
|
2010-11-30 04:41:59 -06:00
|
|
|
The kill command is part of the util-linux package and is available from
|
2016-12-17 02:06:57 -06:00
|
|
|
.UR https://\:www.kernel.org\:/pub\:/linux\:/utils\:/util-linux/
|
2013-03-07 17:05:48 -06:00
|
|
|
Linux Kernel Archive
|
|
|
|
.UE .
|