1KILL(1) User Commands KILL(1)
2
3
4
6 kill - terminate a process
7
9 kill [-signal|-s signal|-p] [-q value] [-a] [--] pid|name...
10 kill -l [number] | -L
11
13 The command kill sends the specified signal to the specified processes
14 or process groups.
15
16 If no signal is specified, the TERM signal is sent. The default action
17 for this signal is to terminate the process. This signal should be
18 used in preference to the KILL signal (number 9), since a process may
19 install a handler for the TERM signal in order to perform clean-up
20 steps before terminating in an orderly fashion. If a process does not
21 terminate after a TERM signal has been sent, then the KILL signal may
22 be used; be aware that the latter signal cannot be caught, and so does
23 not give the target process the opportunity to perform any clean-up
24 before terminating.
25
26 Most modern shells have a builtin kill command, with a usage rather
27 similar to that of the command described here. The --all, --pid, and
28 --queue options, and the possibility to specify processes by command
29 name, are local extensions.
30
31 If signal is 0, then no actual signal is sent, but error checking is
32 still performed.
33
34
36 The list of processes to be signaled can be a mixture of names and
37 PIDs.
38
39 pid Each pid can be one of four things:
40
41 n where n is larger than 0. The process with PID n is sig‐
42 naled.
43
44 0 All processes in the current process group are signaled.
45
46 -1 All processes with a PID larger than 1 are signaled.
47
48 -n where n is larger than 1. All processes in process group
49 n are signaled. When an argument of the form '-n' is
50 given, and it is meant to denote a process group, either
51 a signal must be specified first, or the argument must be
52 preceded by a '--' option, otherwise it will be taken as
53 the signal to send.
54
55 name All processes invoked using this name will be signaled.
56
57
59 -s, --signal signal
60 The signal to send. It may be given as a name or a number.
61
62 -l, --list [number]
63 Print a list of signal names, or convert the given signal number
64 to a name. The signals can be found in /usr/include/linux/sig‐
65 nal.h
66
67 -L, --table
68 Similar to -l, but it will print signal names and their corre‐
69 sponding numbers.
70
71 -a, --all
72 Do not restrict the command-name-to-PID conversion to processes
73 with the same UID as the present process.
74
75 -p, --pid
76 Only print the process ID (PID) of the named processes, do not
77 send any signals.
78
79 --verbose
80 Print PID(s) that will be signaled with kill along with the sig‐
81 nal.
82
83 -q, --queue value
84 Use sigqueue(3) rather than kill(2). The value argument is an
85 integer that is sent along with the signal. If the receiving
86 process has installed a handler for this signal using the
87 SA_SIGINFO flag to sigaction(2), then it can obtain this data
88 via the si_sigval field of the siginfo_t structure.
89
90
92 Although it is possible to specify the TID (thread ID, see gettid(2))
93 of one of the threads in a multithreaded process as the argument of
94 kill, the signal is nevertheless directed to the process (i.e., the
95 entire thread group). In other words, it is not possible to send a
96 signal to an explicitly selected thread in a multithreaded process.
97 The signal will be delivered to an arbitrarily selected thread in the
98 target process that is not blocking the signal. For more details, see
99 signal(7) and the description of CLONE_THREAD in clone(2).
100
101
103 kill has the following return codes:
104
105 0 success
106
107 1 failure
108
109 64 partial success (when more than one process specified)
110
111
113 bash(1), tcsh(1), sigaction(2), kill(2), sigqueue(3), signal(7)
114
115
117 Salvatore Valente ⟨svalente@mit.edu⟩
118 Karel Zak ⟨kzak@redhat.com⟩
119
120 The original version was taken from BSD 4.4.
121
122
124 The kill command is part of the util-linux package and is available
125 from Linux Kernel Archive ⟨https://www.kernel.org/pub/linux/utils/util-
126 linux/⟩.
127
128
129
130util-linux July 2014 KILL(1)