]> git.ipfire.org Git - thirdparty/util-linux.git/blame - misc-utils/kill.1
build-sys: add missing NR underscore to UL_CHECK_SYSCALL()
[thirdparty/util-linux.git] / misc-utils / kill.1
CommitLineData
6dbe3af9
KZ
1.\" Copyright 1994 Salvatore Valente (svalente@mit.edu)
2.\" Copyright 1992 Rickard E. Faith (faith@cs.unc.edu)
3.\" May be distributed under the GNU General Public License
83098262 4.TH KILL 1 "July 2014" "util-linux" "User Commands"
6dbe3af9
KZ
5.SH NAME
6kill \- terminate a process
7.SH SYNOPSIS
b0315e1f 8.B kill
83098262
BS
9.RB [ \- \fIsignal\fR| \-s
10.IR signal | \fB-p\fP ]
a1504d8b 11.RB [ \-q
83098262 12.IR value ]
821ac2c7 13.RB [ \-a ]
b0315e1f 14.RB [ \-\- ]
83098262 15.IR pid | name ...
6dbe3af9 16.br
83098262
BS
17.B kill \-l
18.RI [ number ]
19.RB "| " \-L
6dbe3af9 20.SH DESCRIPTION
c07ebfa1 21The command
6dbe3af9 22.B kill
83098262 23sends the specified \fIsignal\fR to the specified processes or process groups.
3d463c67
MK
24.PP
25If no signal is specified, the TERM signal is sent.
26The default action for this signal is to terminate the process.
27This signal should be used in preference to the
28KILL signal (number 9), since a process may install a handler for the
29TERM signal in order to perform clean-up steps before terminating in
30an orderly fashion.
31If a process does not terminate after a TERM signal has been sent,
32then the KILL signal may be used; be aware that the latter signal
33cannot be caught, and so does not give the target process the opportunity
8419465d 34to perform any clean-up before terminating.
c07ebfa1 35.PP
85c928ca 36Most modern shells have a builtin kill command, with a usage rather similar to
83098262
BS
37that of the command described here. The
38.BR \-\-all ,
39.BR \-\-pid ", and"
0bb7e904 40.B \-\-queue
83098262 41options, and the possibility to specify processes by command name, are local extensions.
bd0fb63d 42.PP
83098262
BS
43If \fIsignal\fR is 0, then no actual signal is sent, but error checking is still performed.
44
45.SH ARGUMENTS
2085ba6c 46The list of processes to be signaled can be a mixture of names and PIDs.
6dbe3af9 47.TP
83098262
BS
48.I pid
49Each
6dbe3af9 50.I pid
10ab72e7 51can be one of four things:
c07ebfa1
KZ
52.RS
53.TP
fd6b7a7f
KZ
54.I n
55where
56.I n
2085ba6c 57is larger than 0. The process with PID
fd6b7a7f 58.I n
83098262 59is signaled.
c07ebfa1
KZ
60.TP
61.B 0
62All processes in the current process group are signaled.
63.TP
64.B -1
2085ba6c 65All processes with a PID larger than 1 are signaled.
c07ebfa1
KZ
66.TP
67.BI - n
b0315e1f
PB
68where
69.I n
9e068ce0 70is larger than 1. All processes in process group
fd6b7a7f 71.I n
9e068ce0 72are signaled. When an argument of the form '-n' is given, and it is meant to
83098262 73denote a process group, either a signal must be specified first, or the
9e068ce0
SK
74argument must be preceded by a '--' option, otherwise it will be taken as the
75signal to send.
10ab72e7 76.RE
c07ebfa1 77.TP
10ab72e7 78.I name
83098262
BS
79All processes invoked using this \fIname\fR will be signaled.
80
81.SH OPTIONS
6dbe3af9 82.TP
9e068ce0 83\fB\-s\fR, \fB\-\-signal\fR \fIsignal\fR
83098262 84The signal to send. It may be given as a name or a number.
6dbe3af9 85.TP
83098262
BS
86\fB\-l\fR, \fB\-\-list\fR [\fInumber\fR]
87Print a list of signal names, or convert the given signal number to a name.
88The signals can be found in
9e068ce0 89.I /usr/\:include/\:linux/\:signal.h
c07ebfa1 90.TP
fda84b66 91\fB\-L\fR, \fB\-\-table\fR
83098262 92Similar to \fB\-l\fR, but it will print signal names and their corresponding
fda84b66
SK
93numbers.
94.TP
9e068ce0 95\fB\-a\fR, \fB\-\-all\fR
2085ba6c 96Do not restrict the command-name-to-PID conversion to processes with the same
a72fa61a 97UID as the present process.
c07ebfa1 98.TP
9e068ce0 99\fB\-p\fR, \fB\-\-pid\fR
2085ba6c 100Only print the process ID (PID) of the named processes, do not send any
9e068ce0 101signals.
a1504d8b 102.TP
1c23b1c5 103\fB\-\-verbose\fR
2085ba6c 104Print PID(s) that will be signaled with kill along with the signal.
1c23b1c5 105.TP
83098262 106\fB\-q\fR, \fB\-\-queue\fR \fIvalue\fR
a1504d8b 107Use
b79cc53b 108.BR sigqueue (3)
a1504d8b 109rather than
83098262
BS
110.BR kill (2).
111The
112.I value
113argument is an integer that is sent along with the signal. If the
d9818c9b
MK
114receiving process has installed a handler for this signal using the
115.B SA_SIGINFO
9e068ce0 116flag to
a1504d8b 117.BR sigaction (2),
d9818c9b
MK
118then it can obtain this data via the
119.I si_sigval
120field of the
121.I siginfo_t
122structure.
83098262 123
741587f3 124.SH NOTES
f793f8bc 125Although it is possible to specify the TID (thread ID, see
741587f3 126.BR gettid (2))
f793f8bc
MK
127of one of the threads in a multithreaded process as the argument of
128.BR kill ,
129the signal is nevertheless directed to the process
130(i.e., the entire thread group).
131In other words, it is not possible to send a signal to an
132explicitly selected thread in a multithreaded process.
133The signal will be delivered to an arbitrarily selected thread
134in the target process that is not blocking the signal.
135For more details, see
136.BR signal (7)
137and the description of
0bb7e904 138.B CLONE_THREAD
f793f8bc
MK
139in
140.BR clone (2).
a01f4d43
KZ
141
142.SH RETURN CODES
143.B kill
144has the following return codes:
145.TP
0bb7e904 146.B 0
a01f4d43
KZ
147success
148.TP
0bb7e904 149.B 1
a01f4d43
KZ
150failure
151.TP
0bb7e904 152.B 64
a01f4d43
KZ
153partial success (when more than one process specified)
154
155.SH SEE ALSO
6dbe3af9
KZ
156.BR bash (1),
157.BR tcsh (1),
f76c7478 158.BR sigaction (2),
f053ff1e 159.BR kill (2),
b79cc53b 160.BR sigqueue (3),
c07ebfa1 161.BR signal (7)
6853d664
KZ
162
163.SH AUTHORS
9e068ce0
SK
164.MT svalente@mit.edu
165Salvatore Valente
6853d664
KZ
166.ME
167.br
168.MT kzak@redhat.com
169Karel Zak
170.ME
171.br
172.PP
173The original version was taken from BSD 4.4.
174
86d62711 175.SH AVAILABILITY
601d12fb 176The kill command is part of the util-linux package and is available from
d673b74e 177.UR https://\:www.kernel.org\:/pub\:/linux\:/utils\:/util-linux/
9e068ce0
SK
178Linux Kernel Archive
179.UE .