1.\" $NetBSD: kill.1,v 1.35 2022/08/07 09:36:55 andvar Exp $ 2.\" 3.\" Copyright (c) 1980, 1990, 1993 4.\" The Regents of the University of California. All rights reserved. 5.\" 6.\" This code is derived from software contributed to Berkeley by 7.\" the Institute of Electrical and Electronics Engineers, Inc. 8.\" 9.\" Redistribution and use in source and binary forms, with or without 10.\" modification, are permitted provided that the following conditions 11.\" are met: 12.\" 1. Redistributions of source code must retain the above copyright 13.\" notice, this list of conditions and the following disclaimer. 14.\" 2. Redistributions in binary form must reproduce the above copyright 15.\" notice, this list of conditions and the following disclaimer in the 16.\" documentation and/or other materials provided with the distribution. 17.\" 3. Neither the name of the University nor the names of its contributors 18.\" may be used to endorse or promote products derived from this software 19.\" without specific prior written permission. 20.\" 21.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND 22.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 23.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 24.\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE 25.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 26.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 27.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 28.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 29.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 30.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 31.\" SUCH DAMAGE. 32.\" 33.\" @(#)kill.1 8.2 (Berkeley) 4/28/95 34.\" 35.Dd August 15, 2021 36.Dt KILL 1 37.Os 38.Sh NAME 39.Nm kill 40.Nd terminate or signal a process 41.Sh SYNOPSIS 42.Nm 43.Op Fl s Ar signal_name 44.Ar pid 45\&... 46.Nm 47.Fl l 48.Op Ar exit_status 49.Nm 50.Fl signal_name 51.Ar pid 52\&... 53.Nm 54.Fl signal_number 55.Ar pid 56\&... 57.Sh DESCRIPTION 58The 59.Nm 60utility sends a signal to the process(es) specified 61by the pid operand(s). 62.Pp 63Only the super-user may send signals to other users' processes. 64.Pp 65The options are as follows: 66.Bl -tag -width Ds 67.It Fl s Ar signal_name 68A symbolic signal name specifying the signal to be sent instead of the 69default 70.Dv TERM . 71.It Fl l Op Ar exit_status 72Display the name of the signal corresponding to 73.Ar exit_status . 74.Ar exit_status 75may be the exit status of a command killed by a signal 76(see the 77special 78.Xr sh 1 79parameter 80.Sq ?\& ) 81or a signal number. 82.Pp 83If no operand is given, display the names of all the signals. 84In 85.Pa /bin/kill , 86if the variable 87.Ev POSIXLY_CORRECT 88is set in the environment, this uses the POSIX specified format, 89otherwise a slightly more pleasing layout is used. 90.It Fl signal_name 91A symbolic signal name specifying the signal to be sent instead of the 92default 93.Dv TERM . 94.It Fl signal_number 95A non-negative decimal integer, specifying the signal to be sent instead 96of the default 97.Dv TERM . 98.El 99.Pp 100The following 101.Ar pid Ns s 102have special meanings: 103.Bl -tag -width Ds -compact 104.It -1 105If superuser, broadcast the signal to all processes; otherwise broadcast 106to all processes belonging to the user. 107.It 0 108Broadcast the signal to all processes in the current process group 109belonging to the user. 110.El 111Any other negative 112.Ar pid 113is interpreted as the negative of a process group identifier, 114and the signal is sent to all members of that group. 115.Pp 116Note that while not required by this implementation, 117if the first 118.Ar pid 119operand is negative, it should be preceded by the 120.Dq \&-- 121end of options indicator, to avoid the 122.Ar pid 123being treated as yet more options. 124That is always required if no specific signal is specified 125and the first 126.Ar pid 127is negative, or that pid would be treated as the 128.Ar signal_number . 129.Pp 130Some of the more commonly used signals: 131.Bl -tag -width Ds -compact 132.It 0 1330 (does not affect the process; can be used to test whether the 134process exists) 135.It 1 136HUP (hang up) 137.It 2 138INT (interrupt) 139.It 3 140QUIT (quit) 141.It 6 142ABRT (abort) 143.It 9 144KILL (non-catchable, non-ignorable kill) 145.It 14 146ALRM (alarm clock) 147.It 15 148TERM (software termination signal) 149.It 17 150STOP (non-catchable, non-ignorable, causes process to temporarily stop, 151after which it can later be resumed using 152.Dv SIGCONT ) 153.It 19 154CONT (stopped processes resume execution) 155.El 156.Pp 157.Nm 158is a built-in to most shells, 159including 160.Xr sh 1 161and 162.Xr csh 1 ; 163it allows job specifiers of the form ``%...'' as arguments 164so process id's are not as often used as 165.Nm 166arguments. 167See 168.Xr csh 1 , 169.Xr sh 1 170or the man page for the shell in use 171for details. 172.Sh DIAGNOSTICS 173.Ex -std 174.Sh SEE ALSO 175.Xr csh 1 , 176.Xr pgrep 1 , 177.Xr pkill 1 , 178.Xr ps 1 , 179.Xr sh 1 , 180.Xr kill 2 , 181.Xr sigaction 2 , 182.Xr signal 7 183.Sh STANDARDS 184The 185.Nm 186utility is expected to be 187.St -p1003.2 188compatible. 189.Sh HISTORY 190A 191.Nm 192command appeared in 193.At v3 194in section 8 of the manual. 195The original BSD description was: 196.Sq terminate a process with extreme prejudice . 197