]> git.ipfire.org Git - thirdparty/util-linux.git/blob - misc-utils/kill.1
Place SEE ALSO entries in order
[thirdparty/util-linux.git] / misc-utils / kill.1
1 .\" Copyright 1994 Salvatore Valente (svalente@mit.edu)
2 .\" Copyright 1992 Rickard E. Faith (faith@cs.unc.edu)
3 .\" May be distributed under the GNU General Public License
4 .TH KILL 1 "July 2014" "util-linux" "User Commands"
5 .SH NAME
6 kill \- terminate a process
7 .SH SYNOPSIS
8 .B kill
9 .RB [ \- \fIsignal\fR| \-s
10 .IR signal | \fB-p\fP ]
11 .RB [ \-q
12 .IR value ]
13 .RB [ \-a ]
14 .RB [ \-\- ]
15 .IR pid | name ...
16 .br
17 .B kill \-l
18 .RI [ number ]
19 .RB "| " \-L
20 .SH DESCRIPTION
21 The command
22 .B kill
23 sends the specified \fIsignal\fR to the specified processes or process groups.
24 If no signal is specified, the TERM signal is sent. This TERM signal will kill
25 processes that do not catch it; for other processes it may be necessary to use
26 the KILL signal (number 9), since this signal cannot be caught.
27 .PP
28 Most modern shells have a builtin kill function, with a usage rather similar to
29 that of the command described here. The
30 .BR \-\-all ,
31 .BR \-\-pid ", and"
32 .BR \-\-queue
33 options, and the possibility to specify processes by command name, are local extensions.
34 .PP
35 If \fIsignal\fR is 0, then no actual signal is sent, but error checking is still performed.
36
37 .SH ARGUMENTS
38 The list of processes to be signaled can be a mixture of names and pids.
39 .TP
40 .I pid
41 Each
42 .I pid
43 can be one of four things:
44 .RS
45 .TP
46 .I n
47 where
48 .I n
49 is larger than 0. The process with pid
50 .I n
51 is signaled.
52 .TP
53 .B 0
54 All processes in the current process group are signaled.
55 .TP
56 .B -1
57 All processes with a pid larger than 1 are signaled.
58 .TP
59 .BI - n
60 where
61 .I n
62 is larger than 1. All processes in process group
63 .I n
64 are signaled. When an argument of the form '-n' is given, and it is meant to
65 denote a process group, either a signal must be specified first, or the
66 argument must be preceded by a '--' option, otherwise it will be taken as the
67 signal to send.
68 .RE
69 .TP
70 .I name
71 All processes invoked using this \fIname\fR will be signaled.
72
73 .SH OPTIONS
74 .TP
75 \fB\-s\fR, \fB\-\-signal\fR \fIsignal\fR
76 The signal to send. It may be given as a name or a number.
77 .TP
78 \fB\-l\fR, \fB\-\-list\fR [\fInumber\fR]
79 Print a list of signal names, or convert the given signal number to a name.
80 The signals can be found in
81 .I /usr/\:include/\:linux/\:signal.h
82 .TP
83 \fB\-L\fR, \fB\-\-table\fR
84 Similar to \fB\-l\fR, but it will print signal names and their corresponding
85 numbers.
86 .TP
87 \fB\-a\fR, \fB\-\-all\fR
88 Do not restrict the command-name-to-pid conversion to processes with the same
89 uid as the present process.
90 .TP
91 \fB\-p\fR, \fB\-\-pid\fR
92 Only print the process id (pid) of the named processes, do not send any
93 signals.
94 .TP
95 \fB\-\-verbose\fR
96 Print pid(s) that will be signaled with kill along with the signal.
97 .TP
98 \fB\-q\fR, \fB\-\-queue\fR \fIvalue\fR
99 Use
100 .BR sigqueue (2)
101 rather than
102 .BR kill (2).
103 The
104 .I value
105 argument is an integer that is sent along with the signal. If the
106 receiving process has installed a handler for this signal using the SA_SIGINFO
107 flag to
108 .BR sigaction (2),
109 then it can obtain this data via the si_sigval field of the siginfo_t structure.
110
111 .SH NOTES
112 It is not possible to send a signal to an explicitly selected thread in a
113 multithreaded process using the
114 .BR kill (2)
115 syscall. If
116 .BR kill (2)
117 is used to send a signal to a thread group, then the kernel selects an arbitrary
118 member of the thread group that has not blocked the signal. For more details
119 see
120 .BR clone (2),
121 the CLONE_THREAD description.
122 .PP
123 The command
124 .BR kill (1)
125 as well as syscall
126 .BR kill (2)
127 accept a TID (thread ID, see
128 .BR gettid (2))
129 as an argument. In this case the kill behavior is not changed and the signal is
130 also delivered to the thread group rather than to the specified thread.
131
132 .SH RETURN CODES
133 .B kill
134 has the following return codes:
135 .TP
136 .BR 0
137 success
138 .TP
139 .BR 1
140 failure
141 .TP
142 .BR 64
143 partial success (when more than one process specified)
144
145 .SH SEE ALSO
146 .BR bash (1),
147 .BR tcsh (1),
148 .BR sigvec (2),
149 .BR kill (2),
150 .BR signal (7)
151
152 .SH AUTHORS
153 .MT svalente@mit.edu
154 Salvatore Valente
155 .ME
156 .br
157 .MT kzak@redhat.com
158 Karel Zak
159 .ME
160 .br
161 .PP
162 The original version was taken from BSD 4.4.
163
164 .SH AVAILABILITY
165 The kill command is part of the util-linux package and is available from
166 .UR ftp://\:ftp.kernel.org\:/pub\:/linux\:/utils\:/util-linux/
167 Linux Kernel Archive
168 .UE .