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