1KILL(1)                          User Commands                         KILL(1)
2
3
4

NAME

6       kill - terminate a process
7

SYNOPSIS

9       kill  [-signal|-s signal|-p]  [-q value] [-a] [--timeout milliseconds
10       signal] [--] pid|name...
11
12       kill -l [number] | -L
13

DESCRIPTION

15       The command kill sends the specified signal to the specified processes
16       or process groups.
17
18       If no signal is specified, the TERM signal is sent. The default action
19       for this signal is to terminate the process. This signal should be used
20       in preference to the KILL signal (number 9), since a process may
21       install a handler for the TERM signal in order to perform clean-up
22       steps before terminating in an orderly fashion. If a process does not
23       terminate after a TERM signal has been sent, then the KILL signal may
24       be used; be aware that the latter signal cannot be caught, and so does
25       not give the target process the opportunity to perform any clean-up
26       before terminating.
27
28       Most modern shells have a builtin kill command, with a usage rather
29       similar to that of the command described here. The --all, --pid, and
30       --queue options, and the possibility to specify processes by command
31       name, are local extensions.
32
33       If signal is 0, then no actual signal is sent, but error checking is
34       still performed.
35

ARGUMENTS

37       The list of processes to be signaled can be a mixture of names and
38       PIDs.
39
40       pid
41           Each pid can be expressed in one of the following ways:
42
43           n
44               where n is larger than 0. The process with PID n is signaled.
45
46           0
47               All processes in the current process group are signaled.
48
49           -1
50               All processes with a PID larger than 1 are signaled.
51
52           -n
53               where n is larger than 1. All processes in process group n are
54               signaled. When an argument of the form '-n' is given, and it is
55               meant to denote a process group, either a signal must be
56               specified first, or the argument must be preceded by a '--'
57               option, otherwise it will be taken as the signal to send.
58
59       name
60           All processes invoked using this name will be signaled.
61

OPTIONS

63       -s, --signal signal
64           The signal to send. It may be given as a name or a number.
65
66       -l, --list [number]
67           Print a list of signal names, or convert the given signal number to
68           a name. The signals can be found in /usr/include/linux/signal.h.
69
70       -L, --table
71           Similar to -l, but it will print signal names and their
72           corresponding numbers.
73
74       -a, --all
75           Do not restrict the command-name-to-PID conversion to processes
76           with the same UID as the present process.
77
78       -p, --pid
79           Only print the process ID (PID) of the named processes, do not send
80           any signals.
81
82       -r, --require-handler
83           Do not send the signal if it is not caught in userspace by the
84           signalled process.
85
86       --verbose
87           Print PID(s) that will be signaled with kill along with the signal.
88
89       -q, --queue value
90           Send the signal using sigqueue(3) rather than kill(2). The value
91           argument is an integer that is sent along with the signal. If the
92           receiving process has installed a handler for this signal using the
93           SA_SIGINFO flag to sigaction(2), then it can obtain this data via
94           the si_sigval field of the siginfo_t structure.
95
96       --timeout milliseconds signal
97           Send a signal defined in the usual way to a process, followed by an
98           additional signal after a specified delay. The --timeout option
99           causes kill to wait for a period defined in milliseconds before
100           sending a follow-up signal to the process. This feature is
101           implemented using the Linux kernel PID file descriptor feature in
102           order to guarantee that the follow-up signal is sent to the same
103           process or not sent if the process no longer exists.
104
105           Note that the operating system may re-use PIDs and implementing an
106           equivalent feature in a shell using kill and sleep would be subject
107           to races whereby the follow-up signal might be sent to a different
108           process that used a recycled PID.
109
110           The --timeout option can be specified multiple times: the signals
111           are sent sequentially with the specified timeouts. The --timeout
112           option can be combined with the --queue option.
113
114           As an example, the following command sends the signals QUIT, TERM
115           and KILL in sequence and waits for 1000 milliseconds between
116           sending the signals:
117
118               kill --verbose --timeout 1000 TERM --timeout 1000 KILL \
119                       --signal QUIT 12345
120

EXIT STATUS

122       kill has the following exit status values:
123
124       0
125           success
126
127       1
128           failure
129
130       64
131           partial success (when more than one process specified)
132

NOTES

134       Although it is possible to specify the TID (thread ID, see gettid(2))
135       of one of the threads in a multithreaded process as the argument of
136       kill, the signal is nevertheless directed to the process (i.e., the
137       entire thread group). In other words, it is not possible to send a
138       signal to an explicitly selected thread in a multithreaded process. The
139       signal will be delivered to an arbitrarily selected thread in the
140       target process that is not blocking the signal. For more details, see
141       signal(7) and the description of CLONE_THREAD in clone(2).
142
143       Various shells provide a builtin kill command that is preferred in
144       relation to the kill(1) executable described by this manual. The
145       easiest way to ensure one is executing the command described in this
146       page is to use the full path when calling the command, for example:
147       /bin/kill --version
148

AUTHORS

150       Salvatore Valente <svalente@mit.edu>, Karel Zak <kzak@redhat.com>
151
152       The original version was taken from BSD 4.4.
153

SEE ALSO

155       bash(1), tcsh(1), sigaction(2), kill(2), sigqueue(3), signal(7)
156

REPORTING BUGS

158       For bug reports, use the issue tracker at
159       https://github.com/util-linux/util-linux/issues.
160

AVAILABILITY

162       The kill command is part of the util-linux package which can be
163       downloaded from Linux Kernel Archive
164       <https://www.kernel.org/pub/linux/utils/util-linux/>.
165
166
167
168util-linux 2.39.2                 2023-06-14                           KILL(1)
Impressum