9103 opengroup acknowledgement should be properly formatted in man pages
[unleashed.git] / usr / src / man / man1 / kill.1
blobf772da742130f2443d5386475e2c460f754753aa
1 .\"
2 .\" Sun Microsystems, Inc. gratefully acknowledges The Open Group for
3 .\" permission to reproduce portions of its copyrighted documentation.
4 .\" Original documentation from The Open Group can be obtained online at
5 .\" http://www.opengroup.org/bookstore/.
6 .\"
7 .\" The Institute of Electrical and Electronics Engineers and The Open
8 .\" Group, have given us permission to reprint portions of their
9 .\" documentation.
10 .\"
11 .\" In the following statement, the phrase ``this text'' refers to portions
12 .\" of the system documentation.
13 .\"
14 .\" Portions of this text are reprinted and reproduced in electronic form
15 .\" in the SunOS Reference Manual, from IEEE Std 1003.1, 2004 Edition,
16 .\" Standard for Information Technology -- Portable Operating System
17 .\" Interface (POSIX), The Open Group Base Specifications Issue 6,
18 .\" Copyright (C) 2001-2004 by the Institute of Electrical and Electronics
19 .\" Engineers, Inc and The Open Group.  In the event of any discrepancy
20 .\" between these versions and the original IEEE and The Open Group
21 .\" Standard, the original IEEE and The Open Group Standard is the referee
22 .\" document.  The original Standard can be obtained online at
23 .\" http://www.opengroup.org/unix/online.html.
24 .\"
25 .\" This notice shall appear on any product containing this material.
26 .\"
27 .\" The contents of this file are subject to the terms of the
28 .\" Common Development and Distribution License (the "License").
29 .\" You may not use this file except in compliance with the License.
30 .\"
31 .\" You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
32 .\" or http://www.opensolaris.org/os/licensing.
33 .\" See the License for the specific language governing permissions
34 .\" and limitations under the License.
35 .\"
36 .\" When distributing Covered Code, include this CDDL HEADER in each
37 .\" file and include the License file at usr/src/OPENSOLARIS.LICENSE.
38 .\" If applicable, add the following below this CDDL HEADER, with the
39 .\" fields enclosed by brackets "[]" replaced with your own identifying
40 .\" information: Portions Copyright [yyyy] [name of copyright owner]
41 .\"
42 .\"
43 .\" Copyright 1989 AT&T
44 .\" Portions Copyright (c) 1992, X/Open Company Limited All Rights Reserved
45 .\" Portions Copyright (c) 1982-2007 AT&T Knowledge Ventures
46 .\" Copyright (c) 2007, Sun Microsystems, Inc. All Rights Reserved
47 .\"
48 .TH KILL 1 "Aug 11, 2009"
49 .SH NAME
50 kill \- terminate or signal processes
51 .SH SYNOPSIS
52 .LP
53 .nf
54 \fB/usr/bin/kill\fR \fB-s\fR \fIsignal_name\fR \fIpid\fR...
55 .fi
57 .LP
58 .nf
59 \fB/usr/bin/kill\fR \fB-l\fR [\fIexit_status\fR]
60 .fi
62 .LP
63 .nf
64 \fB/usr/bin/kill\fR [\fB-\fIsignal_name\fR\fR] \fIpid\fR...
65 .fi
67 .LP
68 .nf
69 \fB/usr/bin/kill\fR [\fB-\fIsignal_number\fR\fR] \fIpid\fR...
70 .fi
72 .SH DESCRIPTION
73 .sp
74 .LP
75 The \fBkill\fR utility sends a signal to the process or processes specified by
76 each \fIpid\fR operand.
77 .sp
78 .LP
79 For each \fIpid\fR operand, the \fBkill\fR utility performs actions equivalent
80 to the \fBkill\fR(2) function called with the following arguments:
81 .RS +4
82 .TP
84 The value of the \fIpid\fR operand is used as the \fIpid\fR argument.
85 .RE
86 .RS +4
87 .TP
89 The \fIsig\fR argument is the value specified by the \fB-s\fR option, the
90 \fB-\fR\fIsignal_name\fR option, or the \fB-\fR\fIsignal_number\fR option, or,
91 if none of these options is specified, by \fBSIGTERM\fR.
92 .RE
93 .sp
94 .LP
95 The signaled process must belong to the current user unless the user is the
96 super-user.
97 .sp
98 .LP
99 See NOTES for descriptions of the shell built-in versions of \fBkill\fR.
100 .SH OPTIONS
103 The following options are supported:
105 .ne 2
107 \fB\fB-l\fR\fR
109 .RS 18n
110 (The letter ell.) Writes all values of \fIsignal_name\fR supported by the
111 implementation, if no operand is specified. If an \fIexit_status\fR operand is
112 specified and it is a value of the \fB?\fR shell special parameter and
113 \fBwait\fR corresponding to a process that was terminated by a signal, the
114 \fIsignal_name\fR corresponding to the signal that terminated the process is
115 written. If an \fIexit_status\fR operand is specified and it is the unsigned
116 decimal integer value of a signal number, the \fIsignal_name\fR corresponding
117 to that signal is written. Otherwise, the results are unspecified.
121 .ne 2
123 \fB\fB-s\fR \fIsignal_name\fR\fR
125 .RS 18n
126 Specifies the signal to send, using one of the symbolic names defined in the
127 \fB<signal.h>\fR description. Values of \fIsignal_name\fR is recognized in a
128 case-independent fashion, without the \fBSIG\fR prefix. In addition, the
129 symbolic name \fB0\fR is recognized, representing the signal value zero. The
130 corresponding signal is sent instead of \fBSIGTERM\fR.
134 .ne 2
136 \fB\fB-\fR\fIsignal_name\fR\fR
138 .RS 18n
139 Equivalent to \fB-s\fR \fIsignal_name\fR.
143 .ne 2
145 \fB\fB-\fR\fIsignal_number\fR\fR
147 .RS 18n
148 Specifies a non-negative decimal integer, \fIsignal_number\fR, representing the
149 signal to be used instead of \fBSIGTERM\fR, as the \fIsig\fR argument in the
150 effective call to \fBkill\fR(2).
153 .SH OPERANDS
156 The following operands are supported:
158 .ne 2
160 \fB\fIpid\fR\fR
162 .RS 15n
163 One of the following:
164 .RS +4
167 A decimal integer specifying a process or process group to be signaled. The
168 process or processes selected by positive, negative and zero values of the
169 \fIpid\fR operand is as described for the kill function. If process number 0 is
170 specified, all processes in the process group are signaled. If the first
171 \fIpid\fR operand is negative, it should be preceded by \fB\(mi\(mi\fR to keep
172 it from being interpreted as an option.
174 .RS +4
177 A job control job \fBID\fR that identifies a background process group to be
178 signaled. The job control job \fBID\fR notation is applicable only for
179 invocations of \fBkill\fR in the current shell execution environment.
181 The job control job \fBID\fR type of \fIpid\fR is available only on systems
182 supporting the job control option.
186 .ne 2
188 \fB\fIexit_status\fR\fR
190 .RS 15n
191 A decimal integer specifying a signal number or the exit status of a process
192 terminated by a signal.
195 .SH USAGE
198 Process numbers can be found by using \fBps\fR(1).
201 The job control job \fBID\fR notation is not required to work as expected when
202 \fBkill\fR is operating in its own utility execution environment. In either of
203 the following examples:
205 .in +2
207 example% \fBnohup kill %1 &\fR
208 example% \fBsystem( "kill %1");\fR
210 .in -2
215 \fBkill\fR operates in a different environment and does not share the shell's
216 understanding of job numbers.
217 .SH OUTPUT
220 When the \fB-l\fR option is not specified, the standard output is not be used.
223 When the \fB-l\fR option is specified, the symbolic name of each signal is
224 written in the following format:
226 .in +2
228 "%s%c", <\fIsignal_name\fR>, <\fIseparator\fR>
230 .in -2
234 where the \fB<\fR\fIsignal_name\fR\fB>\fR is in upper-case, without the
235 \fBSIG\fR prefix, and the \fB<\fR\fIseparator\fR\fB>\fR is either a newline
236 character or a space character. For the last signal written,
237 \fB<\fR\fIseparator\fR\fB>\fR is a newline character.
240 When both the \fB-l\fR option and \fIexit_status\fR operand are specified, the
241 symbolic name of the corresponding signal is written in the following format:
243 .in +2
245 "%s\en", <\fIsignal_name\fR>
247 .in -2
249 .SH EXAMPLES
251 \fBExample 1 \fRSending the kill signal
254 Any of the commands:
257 .in +2
259 example% \fBkill -9 100 -165\fR
260 example% \fBkill -s kill 100 -165\fR
261 example% \fBkill -s KILL 100 -165\fR
263 .in -2
268 sends the \fBSIGKILL\fR signal to the process whose process \fBID\fR is
269 \fB100\fR and to all processes whose process group \fBID\fR is \fB165\fR,
270 assuming the sending process has permission to send that signal to the
271 specified processes, and that they exist.
274 \fBExample 2 \fRAvoiding ambiguity with an initial negative number
277 To avoid an ambiguity of an initial negative number argument specifying either
278 a signal number or a process group, the former is always be the case.
279 Therefore, to send the default signal to a process group (for example,
280 \fB123\fR), an application should use a command similar to one of the
281 following:
284 .in +2
286 example% \fBkill -TERM -123\fR
287 example% \fBkill -- -123\fR
289 .in -2
292 .SH ENVIRONMENT VARIABLES
295 See \fBenviron\fR(5) for descriptions of the following environment variables
296 that affect the execution of \fBkill\fR: \fBLANG\fR, \fBLC_ALL\fR,
297 \fBLC_CTYPE\fR, \fBLC_MESSAGES\fR, and \fBNLSPATH\fR.
298 .SH EXIT STATUS
301 The following exit values are returned:
303 .ne 2
305 \fB\fB0\fR\fR
307 .RS 6n
308 At least one matching process was found for each \fIpid\fR operand, and the
309 specified signal was successfully processed for at least one matching process.
313 .ne 2
315 \fB\fB>0\fR\fR
317 .RS 6n
318 An error occurred.
321 .SH ATTRIBUTES
324 See \fBattributes\fR(5) for descriptions of the following attributes:
325 .SS "/usr/bin/kill, csh, ksh, sh"
330 box;
331 c | c
332 l | l .
333 ATTRIBUTE TYPE  ATTRIBUTE VALUE
335 CSI     Enabled
337 Interface Stability     Committed
339 Standard        See \fBstandards\fR(5).
342 .SS "ksh93"
347 box;
348 c | c
349 l | l .
350 ATTRIBUTE TYPE  ATTRIBUTE VALUE
352 CSI     Enabled
354 Interface Stability     Uncommitted
357 .SH SEE ALSO
360 \fBcsh\fR(1), \fBgetconf\fR(1), \fBjobs\fR(1), \fBksh\fR(1), \fBksh93\fR(1),
361 \fBps\fR(1), \fBsh\fR(1), \fBshell_builtins\fR(1), \fBwait\fR(1),
362 \fBkill\fR(2), \fBsignal\fR(3C), \fBsignal.h\fR(3HEAD), \fBattributes\fR(5),
363 \fBenviron\fR(5), \fBstandards\fR(5)
364 .SH NOTES
365 .SS "/usr/bin/kill"
368 The number of realtime signals supported is defined by the \fBgetconf\fR(1)
369 value \fB_POSIX_RTSIG_MAX\fR.
370 .SS "sh"
373 The Bourne shell, \fBsh\fR, has a built-in version of \fBkill\fR to provide the
374 functionality of the \fBkill\fR command for processes identified with a
375 \fIjobid\fR. The \fBsh\fR syntax is:
377 .in +2
379 kill [ -sig ] [ pid ] [ %job ]...
380 kill -l
382 .in -2
385 .SS "csh"
388 The C-shell, \fBcsh\fR, also has a built-in \fBkill\fR command, whose syntax
391 .in +2
393 kill [-sig][pid][%job]...
394 kill -l
396 .in -2
401 The \fBcsh\fR \fBkill\fR built-in sends the \fBTERM\fR (terminate) signal, by
402 default, or the signal specified, to the specified process \fBID\fR, the
403 \fIjob\fR indicated, or the current \fIjob\fR. Signals are either specified by
404 number or by name. There is no default. Typing \fBkill\fR does not send a
405 signal to the current job. If the signal being sent is \fBTERM\fR (terminate)
406 or \fBHUP\fR (hangup), then the job or process is sent a \fBCONT\fR (continue)
407 signal as well.
409 .ne 2
411 \fB\fB-l\fR\fR
413 .RS 6n
414 Lists the signal names that can be sent.
417 .SS "ksh"
420 The syntax of the \fBksh\fR \fBkill\fR is:
422 .in +2
424 kill [-sig][pid][%job]...
425 kill -l
427 .in -2
432 The \fBksh\fR \fBkill\fR sends either the \fBTERM\fR (terminate) signal or the
433 specified signal to the specified jobs or processes. Signals are either
434 specified by number or by names (as specified in \fBsignal.h\fR(3HEAD) stripped
435 of the \fBSIG\fR prefix). If the signal being sent is \fBTERM\fR (terminate) or
436 \fBHUP\fR (hangup), then the job or process is sent a \fBCONT\fR (continue)
437 signal if it is stopped. The argument \fIjob\fR can be the process id of a
438 process that is not a member of one of the active jobs. In the second form,
439 \fBkill\fR \fB-l\fR, the signal numbers and names are listed.
440 .SS "ksh93"
443 The syntax of the \fBksh93\fR \fBkill\fR is:
445 .in +2
447 kill [-n signum] [-s signame] job ...
448 kill [-n signum] [-s signame] -l [arg ...]
450 .in -2
455 With the first form in which \fB-l\fR is not specified, \fBkill\fR sends a
456 signal to one or more processes specified by \fIjob\fR. This normally
457 terminates the processes unless the signal is being caught or ignored.
460 Specify \fIjob\fR as one of the following:
462 .ne 2
464 \fB\fInumber\fR\fR
466 .RS 12n
467 The process id of \fIjob\fR.
471 .ne 2
473 \fB\fB-\fR\fInumber\fR\fR
475 .RS 12n
476 The process group id of \fIjob\fR.
480 .ne 2
482 \fB\fB%\fR\fInumber\fR\fR
484 .RS 12n
485 The job number.
489 .ne 2
491 \fB\fB%\fR\fIstring\fR\fR
493 .RS 12n
494 The job whose name begins with \fIstring\fR.
498 .ne 2
500 \fB\fB%?\fR\fIstring\fR\fR
502 .RS 12n
503 The job whose name contains \fIstring\fR.
507 .ne 2
509 \fB\fB%+\fR\fR
513 \fB\fB%%\fR\fR
515 .RS 12n
516 The current job.
520 .ne 2
522 \fB\fB%-\fR\fR
524 .RS 12n
525 The previous job.
530 If the signal is not specified with either the \fB-n\fR or the \fB-s\fR option,
531 the \fBSIGTERM\fR signal is used.
534 If \fB-l\fR is specified, and no \fIarg\fR is specified, then \fBkill\fR writes
535 the list of signals to standard output. Otherwise, \fIarg\fR can be either a
536 signal name, or a number representing either a signal number or exit status for
537 a process that was terminated due to a signal. If a name is specified  the
538 corresponding signal number is written to standard output. If a number is
539 specified the corresponding signal name is written to standard output.
541 .ne 2
543 \fB\fB-l\fR\fR
545 .RS 14n
546 List signal names or signal numbers rather than sending signals as described
547 above. The \fB-n\fR and \fB-s\fR options cannot be specified.
551 .ne 2
553 \fB\fB-n\fR \fIsignum\fR\fR
555 .RS 14n
556 Specify a signal number to send. Signal numbers are not portable across
557 platforms, except for the following:
559 .ne 2
561 \fB\fB0\fR\fR
563 .RS 6n
564 No signal.
568 .ne 2
570 \fB\fB1\fR\fR
572 .RS 6n
573 \fBHUP\fR
577 .ne 2
579 \fB\fB2\fR\fR
581 .RS 6n
582 \fBINT\fR
586 .ne 2
588 \fB\fB3\fR\fR
590 .RS 6n
591 \fBQUIT\fR
595 .ne 2
597 \fB\fB6\fR\fR
599 .RS 6n
600 \fBABRT\fR
604 .ne 2
606 \fB\fB9\fR\fR
608 .RS 6n
609 \fBKILL\fR
613 .ne 2
615 \fB\fB14\fR\fR
617 .RS 6n
618 \fBALRM\fR
622 .ne 2
624 \fB\fB15\fR\fR
626 .RS 6n
627 \fBTERM\fR
633 .ne 2
635 \fB\fB-s\fR \fIsigname\fR\fR
637 .RS 14n
638 Specify a signal name to send. The signal names are derived from their names in
639 \fB<signal.h>\fR without the \fBSIG\fR prefix and are case insensitive.
640 \fBkill\fR \fB-l\fR generates the list of signals on the current platform.
645 \fBkill\fR in \fBksh93\fR exits with one of the following values:
647 .ne 2
649 \fB\fB0\fR\fR
651 .RS 6n
652 At least one matching process was found for each job operand, and the specified
653 signal was successfully sent to at least one matching process.
657 .ne 2
659 \fB\fB>0\fR\fR
661 .RS 6n
662 An error occurred.