]>
Commit | Line | Data |
---|---|---|
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 |
6 | kill \- 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 | 21 | The command |
6dbe3af9 | 22 | .B kill |
83098262 | 23 | sends the specified \fIsignal\fR to the specified processes or process groups. |
3d463c67 MK |
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 | |
8419465d | 34 | to perform any clean-up before terminating. |
c07ebfa1 | 35 | .PP |
85c928ca | 36 | Most modern shells have a builtin kill command, with a usage rather similar to |
83098262 BS |
37 | that of the command described here. The |
38 | .BR \-\-all , | |
39 | .BR \-\-pid ", and" | |
0bb7e904 | 40 | .B \-\-queue |
83098262 | 41 | options, and the possibility to specify processes by command name, are local extensions. |
bd0fb63d | 42 | .PP |
83098262 BS |
43 | If \fIsignal\fR is 0, then no actual signal is sent, but error checking is still performed. |
44 | ||
45 | .SH ARGUMENTS | |
2085ba6c | 46 | The list of processes to be signaled can be a mixture of names and PIDs. |
6dbe3af9 | 47 | .TP |
83098262 BS |
48 | .I pid |
49 | Each | |
6dbe3af9 | 50 | .I pid |
10ab72e7 | 51 | can be one of four things: |
c07ebfa1 KZ |
52 | .RS |
53 | .TP | |
fd6b7a7f KZ |
54 | .I n |
55 | where | |
56 | .I n | |
2085ba6c | 57 | is larger than 0. The process with PID |
fd6b7a7f | 58 | .I n |
83098262 | 59 | is signaled. |
c07ebfa1 KZ |
60 | .TP |
61 | .B 0 | |
62 | All processes in the current process group are signaled. | |
63 | .TP | |
64 | .B -1 | |
2085ba6c | 65 | All processes with a PID larger than 1 are signaled. |
c07ebfa1 KZ |
66 | .TP |
67 | .BI - n | |
b0315e1f PB |
68 | where |
69 | .I n | |
9e068ce0 | 70 | is larger than 1. All processes in process group |
fd6b7a7f | 71 | .I n |
9e068ce0 | 72 | are signaled. When an argument of the form '-n' is given, and it is meant to |
83098262 | 73 | denote a process group, either a signal must be specified first, or the |
9e068ce0 SK |
74 | argument must be preceded by a '--' option, otherwise it will be taken as the |
75 | signal to send. | |
10ab72e7 | 76 | .RE |
c07ebfa1 | 77 | .TP |
10ab72e7 | 78 | .I name |
83098262 BS |
79 | All 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 | 84 | The 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] |
87 | Print a list of signal names, or convert the given signal number to a name. | |
88 | The 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 | 92 | Similar to \fB\-l\fR, but it will print signal names and their corresponding |
fda84b66 SK |
93 | numbers. |
94 | .TP | |
9e068ce0 | 95 | \fB\-a\fR, \fB\-\-all\fR |
2085ba6c | 96 | Do not restrict the command-name-to-PID conversion to processes with the same |
a72fa61a | 97 | UID as the present process. |
c07ebfa1 | 98 | .TP |
9e068ce0 | 99 | \fB\-p\fR, \fB\-\-pid\fR |
2085ba6c | 100 | Only print the process ID (PID) of the named processes, do not send any |
9e068ce0 | 101 | signals. |
a1504d8b | 102 | .TP |
1c23b1c5 | 103 | \fB\-\-verbose\fR |
2085ba6c | 104 | Print 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 | 107 | Use |
b79cc53b | 108 | .BR sigqueue (3) |
a1504d8b | 109 | rather than |
83098262 BS |
110 | .BR kill (2). |
111 | The | |
112 | .I value | |
113 | argument is an integer that is sent along with the signal. If the | |
d9818c9b MK |
114 | receiving process has installed a handler for this signal using the |
115 | .B SA_SIGINFO | |
9e068ce0 | 116 | flag to |
a1504d8b | 117 | .BR sigaction (2), |
d9818c9b MK |
118 | then it can obtain this data via the |
119 | .I si_sigval | |
120 | field of the | |
121 | .I siginfo_t | |
122 | structure. | |
83098262 | 123 | |
741587f3 | 124 | .SH NOTES |
f793f8bc | 125 | Although it is possible to specify the TID (thread ID, see |
741587f3 | 126 | .BR gettid (2)) |
f793f8bc MK |
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 | |
0bb7e904 | 138 | .B CLONE_THREAD |
f793f8bc MK |
139 | in |
140 | .BR clone (2). | |
a01f4d43 KZ |
141 | |
142 | .SH RETURN CODES | |
143 | .B kill | |
144 | has the following return codes: | |
145 | .TP | |
0bb7e904 | 146 | .B 0 |
a01f4d43 KZ |
147 | success |
148 | .TP | |
0bb7e904 | 149 | .B 1 |
a01f4d43 KZ |
150 | failure |
151 | .TP | |
0bb7e904 | 152 | .B 64 |
a01f4d43 KZ |
153 | partial 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 |
165 | Salvatore Valente | |
6853d664 KZ |
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 | ||
86d62711 | 175 | .SH AVAILABILITY |
601d12fb | 176 | The 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 |
178 | Linux Kernel Archive |
179 | .UE . |