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

NAME

6       kill - terminate or signal processes
7

SYNOPSIS

9       /usr/bin/kill -s signal_name pid...
10
11
12       /usr/bin/kill -l [exit_status]
13
14
15       /usr/bin/kill [-signal_name] pid...
16
17
18       /usr/bin/kill [-signal_number] pid...
19
20

DESCRIPTION

22       The  kill  utility sends a signal to the process or processes specified
23       by each pid operand.
24
25
26       For each pid operand, the kill utility performs actions  equivalent  to
27       the kill(2) function called with the following arguments:
28
29           1.     The value of the pid operand is used as the pid argument.
30
31           2.     The  sig  argument  is the value specified by the -s option,
32                  the -signal_name option, or the -signal_number  option,  or,
33                  if none of these options is specified, by SIGTERM.
34
35
36       The signaled process must belong to the current user unless the user is
37       the super-user.
38
39
40       See NOTES for descriptions of the shell built-in versions of kill.
41

OPTIONS

43       The following options are supported:
44
45       -l                (The letter ell.) Writes all  values  of  signal_name
46                         supported  by  the  implementation,  if no operand is
47                         specified. If an exit_status operand is specified and
48                         it  is  a  value of the ? shell special parameter and
49                         wait corresponding to a process that  was  terminated
50                         by  a  signal,  the  signal_name corresponding to the
51                         signal that terminated the process is written. If  an
52                         exit_status  operand  is  specified  and  it  is  the
53                         unsigned decimal integer value of  a  signal  number,
54                         the signal_name corresponding to that signal is writ‐
55                         ten. Otherwise, the results are unspecified.
56
57
58       -s signal_name    Specifies the signal to send, using one of  the  sym‐
59                         bolic  names  defined  in the <signal.h> description.
60                         Values of signal_name is recognized in  a  case-inde‐
61                         pendent fashion, without the SIG prefix. In addition,
62                         the symbolic name 0 is recognized,  representing  the
63                         signal  value  zero. The corresponding signal is sent
64                         instead of SIGTERM.
65
66
67       -signal_name      Equivalent to -s signal_name.
68
69
70       -signal_number    Specifies a non-negative decimal integer, signal_num‐
71                         ber,  representing  the  signal to be used instead of
72                         SIGTERM, as the sig argument in   the effective  call
73                         to kill(2).
74
75

OPERANDS

77       The following operands are supported:
78
79       pid            One of the following:
80
81                          1.     A  decimal  integer  specifying  a process or
82                                 process group to be signaled. The process  or
83                                 processes  selected by positive, negative and
84                                 zero  values  of  the  pid  operand   is   as
85                                 described  for  the kill function. If process
86                                 number 0 is specified, all processes  in  the
87                                 process  group are signaled. If the first pid
88                                 operand is negative, it should be preceded by
89                                 −−  to  keep  it from being interpreted as an
90                                 option.
91
92                          2.     A job control job ID that identifies a  back‐
93                                 ground  process group to be signaled. The job
94                                 control job ID notation  is  applicable  only
95                                 for  invocations of kill in the current shell
96                                 execution environment.
97                      The job control job ID type of pid is available only  on
98                      systems supporting the job control option.
99
100
101       exit_status    A decimal integer specifying a signal number or the exit
102                      status of a process terminated by a signal.
103
104

USAGE

106       Process numbers can be found by using ps(1).
107
108
109       The job control job ID notation is not required  to  work  as  expected
110       when  kill  is  operating  in its own utility execution environment. In
111       either of the following examples:
112
113         example% nohup kill %1 &
114         example% system( "kill %1");
115
116
117
118
119       kill operates in a different environment and does not share the shell's
120       understanding of job numbers.
121

OUTPUT

123       When  the  -l  option  is  not specified, the standard output is not be
124       used.
125
126
127       When the -l option is specified, the symbolic name of  each  signal  is
128       written in the following format:
129
130         "%s%c", <signal_name>, <separator>
131
132
133
134       where  the  <signal_name> is in upper-case, without the SIG prefix, and
135       the <separator> is either a newline character or a space character. For
136       the last signal written, <separator> is a newline character.
137
138
139       When both the -l option and exit_status operand are specified, the sym‐
140       bolic name of the corresponding signal is written in the following for‐
141       mat:
142
143         "%s\n", <signal_name>
144
145

EXAMPLES

147       Example 1 Sending the kill signal
148
149
150       Any of the commands:
151
152
153         example% kill -9 100 -165
154         example% kill -s kill 100 -165
155         example% kill -s KILL 100 -165
156
157
158
159
160       sends  the SIGKILL signal to the process whose process ID is 100 and to
161       all processes whose process group  ID  is  165,  assuming  the  sending
162       process  has permission to send that signal to the specified processes,
163       and that they exist.
164
165
166       Example 2 Avoiding ambiguity with an initial negative number
167
168
169       To avoid an ambiguity of an initial negative number argument specifying
170       either  a signal number or a process group, the former is always be the
171       case. Therefore, to send the default signal to  a  process  group  (for
172       example,  123),  an  application should use a command similar to one of
173       the following:
174
175
176         example% kill -TERM -123
177         example% kill -- -123
178
179
180

ENVIRONMENT VARIABLES

182       See environ(5) for descriptions of the following environment  variables
183       that affect the execution of kill: LANG, LC_ALL, LC_CTYPE, LC_MESSAGES,
184       and NLSPATH.
185

EXIT STATUS

187       The following exit values are returned:
188
189       0     At least one matching process was found for each pid operand, and
190             the  specified signal was successfully processed for at least one
191             matching process.
192
193
194       >0    An error occurred.
195
196

ATTRIBUTES

198       See attributes(5) for descriptions of the following attributes:
199
200   /usr/bin/kill, csh, ksh, sh
201       ┌─────────────────────────────┬─────────────────────────────┐
202       │      ATTRIBUTE TYPE         │      ATTRIBUTE VALUE        │
203       ├─────────────────────────────┼─────────────────────────────┤
204       │Availability                 │SUNWcsu                      │
205       ├─────────────────────────────┼─────────────────────────────┤
206       │CSI                          │Enabled                      │
207       ├─────────────────────────────┼─────────────────────────────┤
208       │Interface Stability          │Committed                    │
209       ├─────────────────────────────┼─────────────────────────────┤
210       │Standard                     │See standards(5).            │
211       └─────────────────────────────┴─────────────────────────────┘
212
213   ksh93
214       ┌─────────────────────────────┬─────────────────────────────┐
215       │      ATTRIBUTE TYPE         │      ATTRIBUTE VALUE        │
216       ├─────────────────────────────┼─────────────────────────────┤
217       │Availability                 │SUNWcsu                      │
218       ├─────────────────────────────┼─────────────────────────────┤
219       │CSI                          │Enabled                      │
220       ├─────────────────────────────┼─────────────────────────────┤
221       │Interface Stability          │Uncommitted                  │
222       └─────────────────────────────┴─────────────────────────────┘
223

SEE ALSO

225       csh(1),  getconf(1),   jobs(1),   ksh(1),   ksh93(1),   ps(1),   sh(1),
226       shell_builtins(1),   wait(1),   kill(2),  signal(3C),  signal.h(3HEAD),
227       attributes(5), environ(5), standards(5)
228

NOTES

230   /usr/bin/kill
231       The number of realtime signals supported is defined by  the  getconf(1)
232       value _POSIX_RTSIG_MAX.
233
234   sh
235       The  Bourne  shell,  sh,  has a built-in version of kill to provide the
236       functionality of the kill  command  for  processes  identified  with  a
237       jobid. The sh syntax is:
238
239         kill [ -sig ] [ pid ] [ %job ]...
240         kill -l
241
242
243
244   csh
245       The C-shell, csh, also has a built-in kill command, whose syntax is:
246
247         kill [-sig][pid][%job]...
248         kill -l
249
250
251
252
253       The csh kill built-in sends the TERM (terminate) signal, by default, or
254       the signal specified, to the specified process ID, the  job  indicated,
255       or  the current job. Signals are either specified by number or by name.
256       There is no default. Typing kill does not send a signal to the  current
257       job. If the signal being sent is TERM (terminate) or HUP (hangup), then
258       the job or process is sent a CONT (continue) signal as well.
259
260       -l    Lists the signal names that can be sent.
261
262
263   ksh
264       The syntax of the ksh kill is:
265
266         kill [-sig][pid][%job]...
267         kill -l
268
269
270
271
272       The ksh kill sends either the TERM (terminate) signal or the  specified
273       signal to the specified jobs or processes. Signals are either specified
274       by number or by names (as specified in signal.h(3HEAD) stripped of  the
275       SIG  prefix).  If  the  signal  being  sent  is TERM (terminate) or HUP
276       (hangup), then the job or process is sent a CONT (continue)  signal  if
277       it is stopped. The argument job can be the process id of a process that
278       is not a member of one of the active jobs. In the second form, kill -l,
279       the signal numbers and names are listed.
280
281   ksh93
282       The syntax of the ksh93 kill is:
283
284         kill [-n signum] [-s signame] job ...
285         kill [-n signum] [-s signame] -l [arg ...]
286
287
288
289
290       With  the  first form in which -l is not specified, kill sends a signal
291       to one or more processes specified by job. This normally terminates the
292       processes unless the signal is being caught or ignored.
293
294
295       Specify job as one of the following:
296
297       number      The process id of job.
298
299
300       -number     The process group id of job.
301
302
303       %number     The job number.
304
305
306       %string     The job whose name begins with string.
307
308
309       %?string    The job whose name contains string.
310
311
312       %+          The current job.
313       %%
314
315       %-          The previous job.
316
317
318
319       If the signal is not specified with either the -n or the -s option, the
320       SIGTERM signal is used.
321
322
323       If -l is specified, and no arg is specified, then kill writes the  list
324       of  signals  to  standard output. Otherwise, arg can be either a signal
325       name, or a number representing either a signal number  or  exit  status
326       for  a process that was terminated due to a signal. If a name is speci‐
327       fied  the corresponding signal number is written to standard output. If
328       a number is specified the corresponding signal name is written to stan‐
329       dard output.
330
331       -l            List signal names or signal numbers rather  than  sending
332                     signals  as described above. The -n and -s options cannot
333                     be specified.
334
335
336       -n signum     Specify a signal number to send. Signal numbers  are  not
337                     portable across platforms, except for the following:
338
339                     0     No signal.
340
341
342                     1     HUP
343
344
345                     2     INT
346
347
348                     3     QUIT
349
350
351                     6     ABRT
352
353
354                     9     KILL
355
356
357                     14    ALRM
358
359
360                     15    TERM
361
362
363
364       -s signame    Specify  a  signal  name  to  send.  The signal names are
365                     derived from their names in <signal.h>  without  the  SIG
366                     prefix  and  are  case insensitive. kill -l generates the
367                     list of signals on the current platform.
368
369
370
371       kill in ksh93 exits with one of the following values:
372
373       0     At least one matching process was found for each job operand, and
374             the specified signal was successfully sent to at least one match‐
375             ing process.
376
377
378       >0    An error occurred.
379
380
381
382
383SunOS 5.11                        11 Aug 2009                          kill(1)
Impressum