xref: /openbsd-src/bin/kill/kill.1 (revision 987aa43969e1cae6f36d493161ff99f918e0d99e)
1*987aa439Sjsg.\"	$OpenBSD: kill.1,v 1.40 2020/02/09 00:21:01 jsg Exp $
2df930be7Sderaadt.\"	$NetBSD: kill.1,v 1.8 1995/09/07 06:30:26 jtc Exp $
3df930be7Sderaadt.\"
4df930be7Sderaadt.\" Copyright (c) 1980, 1990, 1993
5df930be7Sderaadt.\"	The Regents of the University of California.  All rights reserved.
6df930be7Sderaadt.\"
7df930be7Sderaadt.\" This code is derived from software contributed to Berkeley by
8df930be7Sderaadt.\" the Institute of Electrical and Electronics Engineers, Inc.
9df930be7Sderaadt.\"
10df930be7Sderaadt.\" Redistribution and use in source and binary forms, with or without
11df930be7Sderaadt.\" modification, are permitted provided that the following conditions
12df930be7Sderaadt.\" are met:
13df930be7Sderaadt.\" 1. Redistributions of source code must retain the above copyright
14df930be7Sderaadt.\"    notice, this list of conditions and the following disclaimer.
15df930be7Sderaadt.\" 2. Redistributions in binary form must reproduce the above copyright
16df930be7Sderaadt.\"    notice, this list of conditions and the following disclaimer in the
17df930be7Sderaadt.\"    documentation and/or other materials provided with the distribution.
1829295d1cSmillert.\" 3. Neither the name of the University nor the names of its contributors
19df930be7Sderaadt.\"    may be used to endorse or promote products derived from this software
20df930be7Sderaadt.\"    without specific prior written permission.
21df930be7Sderaadt.\"
22df930be7Sderaadt.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
23df930be7Sderaadt.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
24df930be7Sderaadt.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
25df930be7Sderaadt.\" ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
26df930be7Sderaadt.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
27df930be7Sderaadt.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
28df930be7Sderaadt.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
29df930be7Sderaadt.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
30df930be7Sderaadt.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
31df930be7Sderaadt.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
32df930be7Sderaadt.\" SUCH DAMAGE.
33df930be7Sderaadt.\"
34df930be7Sderaadt.\"	@(#)kill.1	8.2 (Berkeley) 4/28/95
35df930be7Sderaadt.\"
36*987aa439Sjsg.Dd $Mdocdate: February 9 2020 $
37df930be7Sderaadt.Dt KILL 1
38df930be7Sderaadt.Os
39df930be7Sderaadt.Sh NAME
40df930be7Sderaadt.Nm kill
41df930be7Sderaadt.Nd terminate or signal a process
42df930be7Sderaadt.Sh SYNOPSIS
437349792aSaaron.Nm kill
44df930be7Sderaadt.Op Fl s Ar signal_name
4503cb09c0Ssobrado.Ar pid ...
467349792aSaaron.Nm kill
47df930be7Sderaadt.Fl l
48df930be7Sderaadt.Op Ar exit_status
497349792aSaaron.Nm kill
5068c3a9c4Sjmc.Fl Ar signal_name
5103cb09c0Ssobrado.Ar pid ...
527349792aSaaron.Nm kill
5368c3a9c4Sjmc.Fl Ar signal_number
5403cb09c0Ssobrado.Ar pid ...
55df930be7Sderaadt.Sh DESCRIPTION
56f81d96dfSaaronThe
57f11c8a18Saaron.Nm
5819da9cefSaaronutility sends a signal to the process(es) specified
5918611b21Saaronby the
6018611b21Saaron.Ar pid
6118611b21Saaronoperand(s).
6219da9cefSaaronIf no signal is specified,
6319da9cefSaaron.Dv SIGTERM
6419da9cefSaaronis used.
65df930be7Sderaadt.Pp
66a3542fadSaaronOnly the superuser may send signals to other users' processes.
67df930be7Sderaadt.Pp
68df930be7SderaadtThe options are as follows:
69df930be7Sderaadt.Bl -tag -width Ds
70df930be7Sderaadt.It Fl l Op Ar exit_status
71f479d822SjmcDisplay the name of the signal corresponding to
72df930be7Sderaadt.Ar exit_status .
73f479d822Sjmc.Ar exit_status
74f479d822Sjmcmay be the exit status of a command killed by a signal
75f479d822Sjmc(see the
76f479d822Sjmcspecial
77f479d822Sjmc.Xr sh 1
78f479d822Sjmcparameter
79f479d822Sjmc.Sq ?\& )
80f479d822Sjmcor a signal number.
81f479d822Sjmc.Pp
82f479d822SjmcIf no operand is given, display the names of all the signals.
83089a84c9Sjmc.It Fl s Ar signal_name
84089a84c9SjmcA symbolic signal name specifying the signal to be sent instead of the
85089a84c9Sjmcdefault
86089a84c9Sjmc.Dv SIGTERM .
8768c3a9c4Sjmc.It Fl Ar signal_name
88df930be7SderaadtA symbolic signal name specifying the signal to be sent instead of the
89df930be7Sderaadtdefault
9018611b21Saaron.Dv SIGTERM .
9168c3a9c4Sjmc.It Fl Ar signal_number
9218611b21SaaronA non-negative decimal integer specifying the signal to be sent instead
93df930be7Sderaadtof the default
9418611b21Saaron.Dv SIGTERM .
95df930be7Sderaadt.El
96df930be7Sderaadt.Pp
97f81d96dfSaaronThe following PIDs have special meanings:
9868c3a9c4Sjmc.Bl -tag -width Ds -offset indent
9919da9cefSaaron.It \-1
100a3542fadSaaronIf superuser, broadcast the signal to all processes; otherwise, broadcast
101df930be7Sderaadtto all processes belonging to the user.
102b6886611Smillert.It 0
103b6886611SmillertSend the signal to all processes whose group ID is equal to the
104b6886611Smillertprocess group ID of the sender, and for which the process has permission.
105a824611dSjsyn.It \- Ns Ar pgid
106a824611dSjsynSend the signal to all processes within the specified process group.
107a824611dSjsyn.El
108a824611dSjsyn.Pp
109df930be7SderaadtSome of the more commonly used signals:
110f81d96dfSaaron.Pp
11119da9cefSaaron.Bl -tag -width Ds -compact -offset indent
112df930be7Sderaadt.It 1
113df930be7SderaadtHUP (hang up)
114df930be7Sderaadt.It 2
115df930be7SderaadtINT (interrupt)
116df930be7Sderaadt.It 3
117df930be7SderaadtQUIT (quit)
118df930be7Sderaadt.It 6
119df930be7SderaadtABRT (abort)
120df930be7Sderaadt.It 9
121df930be7SderaadtKILL (non-catchable, non-ignorable kill)
122df930be7Sderaadt.It 14
123df930be7SderaadtALRM (alarm clock)
124df930be7Sderaadt.It 15
125df930be7SderaadtTERM (software termination signal)
126df930be7Sderaadt.El
127df930be7Sderaadt.Pp
12868c3a9c4SjmcFor a more complete list, consult the
12968c3a9c4Sjmc.Xr sigaction 2
13068c3a9c4Sjmcmanual page.
13168c3a9c4Sjmc.Pp
13268c3a9c4SjmcA signal number of 0
13368c3a9c4Sjmc.Pq Li kill \-0 pid
13468c3a9c4Sjmcchecks the validity of a certain PID, to see if it exists.
13589afb2d5SderaadtAn exit code of 0 means that the specified process exists.
1360a971222Sjmc.Sh EXIT STATUS
1370a971222Sjmc.Ex -std kill
13893256fbcSaaron.Sh EXAMPLES
13968c3a9c4SjmcForcibly terminate process ID 1234:
14093256fbcSaaron.Pp
14168c3a9c4Sjmc.Dl $ kill -9 1234
14293256fbcSaaron.Pp
14393256fbcSaaronSend the
144b4fa3bbbSdlg.Xr init 8
145b4fa3bbbSdlgprocess the hangup signal, instructing it to re-read
146b4fa3bbbSdlg.Xr ttys 5 :
14768c3a9c4Sjmc.Pp
148b4fa3bbbSdlg.Dl # kill -HUP 1
149df930be7Sderaadt.Sh SEE ALSO
150df930be7Sderaadt.Xr csh 1 ,
151ab7e6c46Sjmc.Xr ksh 1 ,
15268c3a9c4Sjmc.Xr pkill 1 ,
153df930be7Sderaadt.Xr ps 1 ,
154df930be7Sderaadt.Xr kill 2 ,
15504851627Sderaadt.Xr sigaction 2
156df930be7Sderaadt.Sh STANDARDS
157df930be7SderaadtThe
158f11c8a18Saaron.Nm
1590f3f4dbcSjmcutility is compliant with the
16099332e38Sjmc.St -p1003.1-2008
1610f3f4dbcSjmcspecification.
162d406b0bbSjmc.Pp
163326fd67bSjmcThe
164326fd67bSjmc.Fl Ar signal_name
165326fd67bSjmcand
166326fd67bSjmc.Fl Ar signal_number
167326fd67bSjmcsyntax is marked by
168326fd67bSjmc.St -p1003.1-2008
169326fd67bSjmcas being an
170326fd67bSjmcX/Open System Interfaces
171326fd67bSjmcoption.
172326fd67bSjmc.Pp
173d406b0bbSjmc.Nm
174d406b0bbSjmcalso exists as a built-in to
175d406b0bbSjmc.Xr csh 1
176d406b0bbSjmcand
177d406b0bbSjmc.Xr ksh 1 ,
178d406b0bbSjmcthough with a different syntax.
179df930be7Sderaadt.Sh HISTORY
180df930be7SderaadtA
181f11c8a18Saaron.Nm
182df930be7Sderaadtcommand appeared in
183*987aa439Sjsg.At v3 .
184