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       kill -l [number] | -L
12

DESCRIPTION

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

ARGUMENTS

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

OPTIONS

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

EXIT STATUS

117       kill has the following exit status values:
118
119              0      success
120              1      failure
121              64     partial success (when more than one process specified)
122

NOTES

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

AUTHORS

140       Salvatore Valente ⟨svalente@mit.edu⟩
141       Karel Zak ⟨kzak@redhat.com⟩
142
143       The original version was taken from BSD 4.4.
144
145

SEE ALSO

147       bash(1), tcsh(1), sigaction(2), kill(2), sigqueue(3), signal(7)
148
149

AVAILABILITY

151       The kill command is part of the util-linux  package  and  is  available
152       from Linux Kernel Archive ⟨https://www.kernel.org/pub/linux/utils/util-
153       linux/⟩.
154
155
156
157util-linux                       November 2019                         KILL(1)
Impressum