]>
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 BS |
23 | sends the specified \fIsignal\fR to the specified processes or process groups. |
24 | If no signal is specified, the TERM signal is sent. This TERM signal will kill | |
25 | processes that do not catch it; for other processes it may be necessary to use | |
26 | the KILL signal (number 9), since this signal cannot be caught. | |
c07ebfa1 | 27 | .PP |
9e068ce0 | 28 | Most modern shells have a builtin kill function, with a usage rather similar to |
83098262 BS |
29 | that of the command described here. The |
30 | .BR \-\-all , | |
31 | .BR \-\-pid ", and" | |
32 | .BR \-\-queue | |
33 | options, and the possibility to specify processes by command name, are local extensions. | |
bd0fb63d | 34 | .PP |
83098262 BS |
35 | If \fIsignal\fR is 0, then no actual signal is sent, but error checking is still performed. |
36 | ||
37 | .SH ARGUMENTS | |
38 | The list of processes to be signaled can be a mixture of names and pids. | |
6dbe3af9 | 39 | .TP |
83098262 BS |
40 | .I pid |
41 | Each | |
6dbe3af9 | 42 | .I pid |
10ab72e7 | 43 | can be one of four things: |
c07ebfa1 KZ |
44 | .RS |
45 | .TP | |
fd6b7a7f KZ |
46 | .I n |
47 | where | |
48 | .I n | |
49 | is larger than 0. The process with pid | |
50 | .I n | |
83098262 | 51 | is signaled. |
c07ebfa1 KZ |
52 | .TP |
53 | .B 0 | |
54 | All processes in the current process group are signaled. | |
55 | .TP | |
56 | .B -1 | |
83098262 | 57 | All processes with a pid larger than 1 are signaled. |
c07ebfa1 KZ |
58 | .TP |
59 | .BI - n | |
b0315e1f PB |
60 | where |
61 | .I n | |
9e068ce0 | 62 | is larger than 1. All processes in process group |
fd6b7a7f | 63 | .I n |
9e068ce0 | 64 | are signaled. When an argument of the form '-n' is given, and it is meant to |
83098262 | 65 | denote a process group, either a signal must be specified first, or the |
9e068ce0 SK |
66 | argument must be preceded by a '--' option, otherwise it will be taken as the |
67 | signal to send. | |
10ab72e7 | 68 | .RE |
c07ebfa1 | 69 | .TP |
10ab72e7 | 70 | .I name |
83098262 BS |
71 | All processes invoked using this \fIname\fR will be signaled. |
72 | ||
73 | .SH OPTIONS | |
6dbe3af9 | 74 | .TP |
9e068ce0 | 75 | \fB\-s\fR, \fB\-\-signal\fR \fIsignal\fR |
83098262 | 76 | The signal to send. It may be given as a name or a number. |
6dbe3af9 | 77 | .TP |
83098262 BS |
78 | \fB\-l\fR, \fB\-\-list\fR [\fInumber\fR] |
79 | Print a list of signal names, or convert the given signal number to a name. | |
80 | The signals can be found in | |
9e068ce0 | 81 | .I /usr/\:include/\:linux/\:signal.h |
c07ebfa1 | 82 | .TP |
fda84b66 | 83 | \fB\-L\fR, \fB\-\-table\fR |
83098262 | 84 | Similar to \fB\-l\fR, but it will print signal names and their corresponding |
fda84b66 SK |
85 | numbers. |
86 | .TP | |
9e068ce0 | 87 | \fB\-a\fR, \fB\-\-all\fR |
d35df4db | 88 | Do not restrict the command-name-to-pid conversion to processes with the same |
9e068ce0 | 89 | uid as the present process. |
c07ebfa1 | 90 | .TP |
9e068ce0 | 91 | \fB\-p\fR, \fB\-\-pid\fR |
83098262 | 92 | Only print the process id (pid) of the named processes, do not send any |
9e068ce0 | 93 | signals. |
a1504d8b | 94 | .TP |
1c23b1c5 RP |
95 | \fB\-\-verbose\fR |
96 | Print pid(s) that will be signaled with kill along with the signal. | |
97 | .TP | |
83098262 | 98 | \fB\-q\fR, \fB\-\-queue\fR \fIvalue\fR |
a1504d8b KZ |
99 | Use |
100 | .BR sigqueue (2) | |
101 | rather than | |
83098262 BS |
102 | .BR kill (2). |
103 | The | |
104 | .I value | |
105 | argument is an integer that is sent along with the signal. If the | |
9e068ce0 SK |
106 | receiving process has installed a handler for this signal using the SA_SIGINFO |
107 | flag to | |
a1504d8b | 108 | .BR sigaction (2), |
83098262 BS |
109 | then it can obtain this data via the si_sigval field of the siginfo_t structure. |
110 | ||
741587f3 | 111 | .SH NOTES |
83098262 BS |
112 | It is not possible to send a signal to an explicitly selected thread in a |
113 | multithreaded process using the | |
741587f3 | 114 | .BR kill (2) |
9e068ce0 | 115 | syscall. If |
5593132a | 116 | .BR kill (2) |
83098262 | 117 | is used to send a signal to a thread group, then the kernel selects an arbitrary |
9e068ce0 SK |
118 | member of the thread group that has not blocked the signal. For more details |
119 | see | |
83098262 BS |
120 | .BR clone (2), |
121 | the CLONE_THREAD description. | |
9e068ce0 | 122 | .PP |
741587f3 KZ |
123 | The command |
124 | .BR kill (1) | |
125 | as well as syscall | |
126 | .BR kill (2) | |
83098262 | 127 | accept a TID (thread ID, see |
741587f3 | 128 | .BR gettid (2)) |
83098262 | 129 | as an argument. In this case the kill behavior is not changed and the signal is |
741587f3 | 130 | also delivered to the thread group rather than to the specified thread. |
a01f4d43 KZ |
131 | |
132 | .SH RETURN CODES | |
133 | .B kill | |
134 | has the following return codes: | |
135 | .TP | |
136 | .BR 0 | |
137 | success | |
138 | .TP | |
139 | .BR 1 | |
140 | failure | |
141 | .TP | |
142 | .BR 64 | |
143 | partial success (when more than one process specified) | |
144 | ||
145 | .SH SEE ALSO | |
6dbe3af9 KZ |
146 | .BR bash (1), |
147 | .BR tcsh (1), | |
c07ebfa1 | 148 | .BR sigvec (2), |
f053ff1e | 149 | .BR kill (2), |
c07ebfa1 | 150 | .BR signal (7) |
6853d664 KZ |
151 | |
152 | .SH AUTHORS | |
9e068ce0 SK |
153 | .MT svalente@mit.edu |
154 | Salvatore Valente | |
6853d664 KZ |
155 | .ME |
156 | .br | |
157 | .MT kzak@redhat.com | |
158 | Karel Zak | |
159 | .ME | |
160 | .br | |
161 | .PP | |
162 | The original version was taken from BSD 4.4. | |
163 | ||
86d62711 | 164 | .SH AVAILABILITY |
601d12fb | 165 | The kill command is part of the util-linux package and is available from |
9e068ce0 SK |
166 | .UR ftp://\:ftp.kernel.org\:/pub\:/linux\:/utils\:/util-linux/ |
167 | Linux Kernel Archive | |
168 | .UE . |