xref: /openbsd/bin/kill/kill.1 (revision 987aa439)
1.\"	$OpenBSD: kill.1,v 1.40 2020/02/09 00:21:01 jsg 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 9 2020 $
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 0
103Send the signal to all processes whose group ID is equal to the
104process group ID of the sender, and for which the process has permission.
105.It \- Ns Ar pgid
106Send the signal to all processes within the specified process group.
107.El
108.Pp
109Some of the more commonly used signals:
110.Pp
111.Bl -tag -width Ds -compact -offset indent
112.It 1
113HUP (hang up)
114.It 2
115INT (interrupt)
116.It 3
117QUIT (quit)
118.It 6
119ABRT (abort)
120.It 9
121KILL (non-catchable, non-ignorable kill)
122.It 14
123ALRM (alarm clock)
124.It 15
125TERM (software termination signal)
126.El
127.Pp
128For a more complete list, consult the
129.Xr sigaction 2
130manual page.
131.Pp
132A signal number of 0
133.Pq Li kill \-0 pid
134checks the validity of a certain PID, to see if it exists.
135An exit code of 0 means that the specified process exists.
136.Sh EXIT STATUS
137.Ex -std kill
138.Sh EXAMPLES
139Forcibly terminate process ID 1234:
140.Pp
141.Dl $ kill -9 1234
142.Pp
143Send the
144.Xr init 8
145process the hangup signal, instructing it to re-read
146.Xr ttys 5 :
147.Pp
148.Dl # kill -HUP 1
149.Sh SEE ALSO
150.Xr csh 1 ,
151.Xr ksh 1 ,
152.Xr pkill 1 ,
153.Xr ps 1 ,
154.Xr kill 2 ,
155.Xr sigaction 2
156.Sh STANDARDS
157The
158.Nm
159utility is compliant with the
160.St -p1003.1-2008
161specification.
162.Pp
163The
164.Fl Ar signal_name
165and
166.Fl Ar signal_number
167syntax is marked by
168.St -p1003.1-2008
169as being an
170X/Open System Interfaces
171option.
172.Pp
173.Nm
174also exists as a built-in to
175.Xr csh 1
176and
177.Xr ksh 1 ,
178though with a different syntax.
179.Sh HISTORY
180A
181.Nm
182command appeared in
183.At v3 .
184