xref: /openbsd/bin/kill/kill.1 (revision 404b540a)
1.\"	$OpenBSD: kill.1,v 1.34 2009/02/08 17:15:09 jmc Exp $
2.\"	$NetBSD: kill.1,v 1.8 1995/09/07 06:30:26 jtc Exp $
3.\"
4.\" Copyright (c) 1980, 1990, 1993
5.\"	The Regents of the University of California.  All rights reserved.
6.\"
7.\" This code is derived from software contributed to Berkeley by
8.\" the Institute of Electrical and Electronics Engineers, Inc.
9.\"
10.\" Redistribution and use in source and binary forms, with or without
11.\" modification, are permitted provided that the following conditions
12.\" are met:
13.\" 1. Redistributions of source code must retain the above copyright
14.\"    notice, this list of conditions and the following disclaimer.
15.\" 2. Redistributions in binary form must reproduce the above copyright
16.\"    notice, this list of conditions and the following disclaimer in the
17.\"    documentation and/or other materials provided with the distribution.
18.\" 3. Neither the name of the University nor the names of its contributors
19.\"    may be used to endorse or promote products derived from this software
20.\"    without specific prior written permission.
21.\"
22.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
23.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
24.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
25.\" ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
26.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
27.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
28.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
29.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
30.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
31.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
32.\" SUCH DAMAGE.
33.\"
34.\"	@(#)kill.1	8.2 (Berkeley) 4/28/95
35.\"
36.Dd $Mdocdate: February 8 2009 $
37.Dt KILL 1
38.Os
39.Sh NAME
40.Nm kill
41.Nd terminate or signal a process
42.Sh SYNOPSIS
43.Nm kill
44.Op Fl s Ar signal_name
45.Ar pid ...
46.Nm kill
47.Fl l
48.Op Ar exit_status
49.Nm kill
50.Fl Ar signal_name
51.Ar pid ...
52.Nm kill
53.Fl Ar signal_number
54.Ar pid ...
55.Sh DESCRIPTION
56The
57.Nm
58utility sends a signal to the process(es) specified
59by the
60.Ar pid
61operand(s).
62If no signal is specified,
63.Dv SIGTERM
64is used.
65.Pp
66Only the superuser may send signals to other users' processes.
67.Pp
68The options are as follows:
69.Bl -tag -width Ds
70.It Fl l Op Ar exit_status
71Display the name of the signal corresponding to
72.Ar exit_status .
73.Ar exit_status
74may be the exit status of a command killed by a signal
75(see the
76special
77.Xr sh 1
78parameter
79.Sq ?\& )
80or a signal number.
81.Pp
82If no operand is given, display the names of all the signals.
83.It Fl s Ar signal_name
84A symbolic signal name specifying the signal to be sent instead of the
85default
86.Dv SIGTERM .
87.It Fl Ar signal_name
88A symbolic signal name specifying the signal to be sent instead of the
89default
90.Dv SIGTERM .
91.It Fl Ar signal_number
92A non-negative decimal integer specifying the signal to be sent instead
93of the default
94.Dv SIGTERM .
95.El
96.Pp
97The following PIDs have special meanings:
98.Bl -tag -width Ds -offset indent
99.It \-1
100If superuser, broadcast the signal to all processes; otherwise, broadcast
101to all processes belonging to the user.
102.It \- Ns Ar pgid
103Send the signal to all processes within the specified process group.
104.El
105.Pp
106Some of the more commonly used signals:
107.Pp
108.Bl -tag -width Ds -compact -offset indent
109.It 1
110HUP (hang up)
111.It 2
112INT (interrupt)
113.It 3
114QUIT (quit)
115.It 6
116ABRT (abort)
117.It 9
118KILL (non-catchable, non-ignorable kill)
119.It 14
120ALRM (alarm clock)
121.It 15
122TERM (software termination signal)
123.El
124.Pp
125For a more complete list, consult the
126.Xr sigaction 2
127manual page.
128.Pp
129A signal number of 0
130.Pq Li kill \-0 pid
131checks the validity of a certain PID, to see if it exists.
132An exit code of 0 means that the specified process exists.
133.Sh EXAMPLES
134Forcibly terminate process ID 1234:
135.Pp
136.Dl $ kill -9 1234
137.Pp
138Send the
139.Xr inetd 8
140daemon the hangup signal, instructing it to re-read its configuration from
141.Pa /etc/inetd.conf :
142.Pp
143.Dl # kill -HUP `cat /var/run/inetd.pid`
144.Sh SEE ALSO
145.Xr csh 1 ,
146.Xr ksh 1 ,
147.Xr pkill 1 ,
148.Xr ps 1 ,
149.Xr kill 2 ,
150.Xr sigaction 2
151.Sh STANDARDS
152The
153.Nm
154utility is compliant with the
155.St -p1003.1-2008
156specification.
157.Pp
158.Nm
159also exists as a built-in to
160.Xr csh 1
161and
162.Xr ksh 1 ,
163though with a different syntax.
164.Sh HISTORY
165A
166.Nm
167command appeared in
168.At v3 .
169