| 1 |
.\" |
| 2 |
.\" Copyright (c) 2002-2024 Craig Small <[email protected]> |
| 3 |
.\" Copyright (c) 2011-2023 Jim Warner <[email protected]> |
| 4 |
.\" Copyright (c) 2011-2012 Sami Kerola <[email protected]> |
| 5 |
.\" Copyright (c) 1998-2003 Albert Cahalan |
| 6 |
.\" |
| 7 |
.\" This program is free software; you can redistribute it and/or modify |
| 8 |
.\" it under the terms of the GNU General Public License as published by |
| 9 |
.\" the Free Software Foundation; either version 2 of the License, or |
| 10 |
.\" (at your option) any later version. |
| 11 |
.\" |
| 12 |
.TH KILL 1 2023-12-27 procps-ng |
| 13 |
.SH NAME |
| 14 |
kill \- send a signal to one or more processes |
| 15 |
.SH SYNOPSIS |
| 16 |
.B kill |
| 17 |
.RB [ \-q\~\c |
| 18 |
.IR value |\c |
| 19 |
.BI \-\-queue \~value\c |
| 20 |
] |
| 21 |
.IR pid " .\|.\|." |
| 22 |
.P |
| 23 |
.B kill |
| 24 |
.BI \- signal |
| 25 |
.RB [ \-q\~\c |
| 26 |
.IR value |\c |
| 27 |
.BI \-\-queue \~value\c |
| 28 |
] |
| 29 |
.IR pid-or-pgid " .\|.\|." |
| 30 |
.br |
| 31 |
.B kill |
| 32 |
.BI \-s \~signal |
| 33 |
.RB [ \-q\~\c |
| 34 |
.IR value |\c |
| 35 |
.BI \-\-queue \~value\c |
| 36 |
] |
| 37 |
.IR pid-or-pgid " .\|.\|." |
| 38 |
.br |
| 39 |
.B kill |
| 40 |
.BI \-\-signal \~signal |
| 41 |
.RB [ \-q\~\c |
| 42 |
.IR value |\c |
| 43 |
.BI \-\-queue \~value\c |
| 44 |
] |
| 45 |
.IR pid-or-pgid " .\|.\|." |
| 46 |
.P |
| 47 |
.BR "kill \-l" \~[\c |
| 48 |
.IR signal ] |
| 49 |
.br |
| 50 |
.BR "kill \-\-list" \~[\c |
| 51 |
.IR signal ] |
| 52 |
.P |
| 53 |
.B "kill \-L" |
| 54 |
.br |
| 55 |
.B "kill \-\-table" |
| 56 |
.SH DESCRIPTION |
| 57 |
.B kill |
| 58 |
sends a signal to one or more processes by |
| 59 |
.I pid |
| 60 |
or |
| 61 |
.IR pgid , |
| 62 |
a process or process group identifier. |
| 63 |
.BR signal (7) |
| 64 |
explains the varieties and behavior of signals. |
| 65 |
.BR kill 's |
| 66 |
default signal is TERM. |
| 67 |
The |
| 68 |
.B \-l |
| 69 |
and |
| 70 |
.B \-L |
| 71 |
options list available signals. |
| 72 |
Particularly useful signals include HUP, |
| 73 |
INT, KILL, STOP, CONT, and 0. |
| 74 |
Specify signals |
| 75 |
by number, |
| 76 |
by name, |
| 77 |
or by name with a \[lq]SIG\[rq] prefix; |
| 78 |
for example, |
| 79 |
.BR \-9 , |
| 80 |
.BR \-SIGKILL , |
| 81 |
and |
| 82 |
.B \-KILL |
| 83 |
are equivalent. |
| 84 |
A negative operand selects a process group; |
| 85 |
see the PGID column in |
| 86 |
.BR ps (1) |
| 87 |
command output. |
| 88 |
A |
| 89 |
.I pid |
| 90 |
of |
| 91 |
.B \-1 |
| 92 |
is special; |
| 93 |
it indicates all processes except the |
| 94 |
.B kill |
| 95 |
process itself and |
| 96 |
.BR init (8). |
| 97 |
.P |
| 98 |
The |
| 99 |
.B \-q |
| 100 |
option uses an alternative signaling method to |
| 101 |
to additionally transmit an integral |
| 102 |
.I value |
| 103 |
to a receiving process. |
| 104 |
If that process has installed a handler for the signal and specified the |
| 105 |
SA_SIGINFO flag to |
| 106 |
.BR sigaction (2), |
| 107 |
then it can obtain this datum via the |
| 108 |
.I \%si_value |
| 109 |
field of the |
| 110 |
.I \%siginfo_t |
| 111 |
structure. |
| 112 |
.SH OPTIONS |
| 113 |
.TP |
| 114 |
.BI \- signal |
| 115 |
.TQ |
| 116 |
.BI \-s \~signal |
| 117 |
.TQ |
| 118 |
.BI \-\-signal \~signal |
| 119 |
Send |
| 120 |
.I signal |
| 121 |
by name or number as described above. |
| 122 |
If |
| 123 |
.I signal |
| 124 |
is 0 (zero), |
| 125 |
.B kill |
| 126 |
sends no signal, |
| 127 |
but still validates its operands; |
| 128 |
this behavior permits the caller to check whether |
| 129 |
the specified |
| 130 |
.IR pid s |
| 131 |
and/or |
| 132 |
.IR pgid s |
| 133 |
exist and it has permission to send them signals. |
| 134 |
.TP |
| 135 |
.BI \-q \~value |
| 136 |
.TQ |
| 137 |
.BI \-\-queue \~value |
| 138 |
Use |
| 139 |
.BR sigqueue (3) |
| 140 |
rather than |
| 141 |
.BR kill (2) |
| 142 |
to additionally send |
| 143 |
.I value |
| 144 |
to each |
| 145 |
.I pid |
| 146 |
or |
| 147 |
.IR pgid . |
| 148 |
.TP |
| 149 |
.BR \-l \~[\fIsignal\fR] |
| 150 |
.TQ |
| 151 |
.BR \-\-list \~[\\fIsignal\fR] |
| 152 |
Without an argument, |
| 153 |
list signal names. |
| 154 |
The optional argument causes |
| 155 |
.B kill |
| 156 |
to convert the specified |
| 157 |
.I signal |
| 158 |
from name to numeric form, |
| 159 |
or vice versa as appropriate, |
| 160 |
and report the translation. |
| 161 |
.TP |
| 162 |
.B \-L |
| 163 |
.TQ |
| 164 |
.B \-\-table |
| 165 |
List signal names in tabular format. |
| 166 |
.SH NOTES |
| 167 |
The shell (command-line interpreter) often has a built-in \[lq]kill\[rq] |
| 168 |
command. |
| 169 |
You may need to run the command described here as |
| 170 |
.I /bin/\:kill |
| 171 |
to override the shell built-in. |
| 172 |
.PP |
| 173 |
If you use a negative operand, |
| 174 |
specify a signal by name or number first so that |
| 175 |
.B kill |
| 176 |
can distinguish it from a process group. |
| 177 |
For example, |
| 178 |
the command |
| 179 |
.RB \[lq] "kill 123 \-9" \[rq] |
| 180 |
is ambiguous; |
| 181 |
it could mean to kill process 123 with signal 9, |
| 182 |
or to kill process 123 and process group 9 with the default signal. |
| 183 |
.SH EXAMPLES |
| 184 |
.TP |
| 185 |
.B kill \-HUP \-1 |
| 186 |
Send hangup signal to all the processes you can. |
| 187 |
.TP |
| 188 |
.B kill \-l 11 |
| 189 |
Report name corresponding to signal number 11. |
| 190 |
.TP |
| 191 |
.B kill 123 543 |
| 192 |
Send the default signal, |
| 193 |
SIGTERM, |
| 194 |
to processes 123 and |
| 195 |
543. |
| 196 |
.TP |
| 197 |
.B kill -SIGTERM -123 |
| 198 |
Send the signal SIGTERM to process group 123. |
| 199 |
.SH "SEE ALSO" |
| 200 |
.BR kill (2), |
| 201 |
.BR killall (1), |
| 202 |
.BR nice (1), |
| 203 |
.BR pkill (1), |
| 204 |
.BR renice (1), |
| 205 |
.BR signal (7), |
| 206 |
.BR sigqueue (3), |
| 207 |
.BR skill (1) |
| 208 |
.SH "REPORTING BUGS" |
| 209 |
Please send bug reports to |
| 210 |
.MT [email protected] |
| 211 |
.ME . |