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       --verbose
83           Print PID(s) that will be signaled with kill along with the signal.
84
85       -q, --queue value
86           Send the signal using sigqueue(3) rather than kill(2). The value
87           argument is an integer that is sent along with the signal. If the
88           receiving process has installed a handler for this signal using the
89           SA_SIGINFO flag to sigaction(2), then it can obtain this data via
90           the si_sigval field of the siginfo_t structure.
91
92       --timeout milliseconds signal
93           Send a signal defined in the usual way to a process, followed by an
94           additional signal after a specified delay. The --timeout option
95           causes kill to wait for a period defined in milliseconds before
96           sending a follow-up signal to the process. This feature is
97           implemented using the Linux kernel PID file descriptor feature in
98           order to guarantee that the follow-up signal is sent to the same
99           process or not sent if the process no longer exists.
100
101           Note that the operating system may re-use PIDs and implementing an
102           equivalent feature in a shell using kill and sleep would be subject
103           to races whereby the follow-up signal might be sent to a different
104           process that used a recycled PID.
105
106           The --timeout option can be specified multiple times: the signals
107           are sent sequentially with the specified timeouts. The --timeout
108           option can be combined with the --queue option.
109
110           As an example, the following command sends the signals QUIT, TERM
111           and KILL in sequence and waits for 1000 milliseconds between
112           sending the signals:
113
114               kill --verbose --timeout 1000 TERM --timeout 1000 KILL \
115                       --signal QUIT 12345
116

EXIT STATUS

118       kill has the following exit status values:
119
120       0
121           success
122
123       1
124           failure
125
126       64
127           partial success (when more than one process specified)
128

NOTES

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

AUTHORS

146       Salvatore Valente <svalente@mit.edu>, Karel Zak <kzak@redhat.com>
147
148       The original version was taken from BSD 4.4.
149

SEE ALSO

151       bash(1), tcsh(1), sigaction(2), kill(2), sigqueue(3), signal(7)
152

REPORTING BUGS

154       For bug reports, use the issue tracker at
155       https://github.com/util-linux/util-linux/issues.
156

AVAILABILITY

158       The kill command is part of the util-linux package which can be
159       downloaded from Linux Kernel Archive
160       <https://www.kernel.org/pub/linux/utils/util-linux/>.
161
162
163
164util-linux 2.38                   2022-02-17                           KILL(1)
Impressum