1*ec52c873Sandvar.\" $NetBSD: kill.1,v 1.35 2022/08/07 09:36:55 andvar Exp $ 249f0ad86Scgd.\" 3667b5ea1Smycroft.\" Copyright (c) 1980, 1990, 1993 4667b5ea1Smycroft.\" The Regents of the University of California. All rights reserved. 561f28255Scgd.\" 661f28255Scgd.\" This code is derived from software contributed to Berkeley by 761f28255Scgd.\" the Institute of Electrical and Electronics Engineers, Inc. 861f28255Scgd.\" 961f28255Scgd.\" Redistribution and use in source and binary forms, with or without 1061f28255Scgd.\" modification, are permitted provided that the following conditions 1161f28255Scgd.\" are met: 1261f28255Scgd.\" 1. Redistributions of source code must retain the above copyright 1361f28255Scgd.\" notice, this list of conditions and the following disclaimer. 1461f28255Scgd.\" 2. Redistributions in binary form must reproduce the above copyright 1561f28255Scgd.\" notice, this list of conditions and the following disclaimer in the 1661f28255Scgd.\" documentation and/or other materials provided with the distribution. 17b5b29542Sagc.\" 3. Neither the name of the University nor the names of its contributors 1861f28255Scgd.\" may be used to endorse or promote products derived from this software 1961f28255Scgd.\" without specific prior written permission. 2061f28255Scgd.\" 2161f28255Scgd.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND 2261f28255Scgd.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 2361f28255Scgd.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 2461f28255Scgd.\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE 2561f28255Scgd.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 2661f28255Scgd.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 2761f28255Scgd.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 2861f28255Scgd.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 2961f28255Scgd.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 3061f28255Scgd.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 3161f28255Scgd.\" SUCH DAMAGE. 3261f28255Scgd.\" 33f859c958Sjtc.\" @(#)kill.1 8.2 (Berkeley) 4/28/95 34346aa5ddScgd.\" 35b6547832Schristos.Dd August 15, 2021 3661f28255Scgd.Dt KILL 1 3761f28255Scgd.Os 3861f28255Scgd.Sh NAME 3961f28255Scgd.Nm kill 4061f28255Scgd.Nd terminate or signal a process 4161f28255Scgd.Sh SYNOPSIS 42c3872193Senami.Nm 430ba34484Sjtc.Op Fl s Ar signal_name 440ba34484Sjtc.Ar pid 450ba34484Sjtc\&... 46990562bfSwiz.Nm 470ba34484Sjtc.Fl l 48acce89e7Swiz.Op Ar exit_status 49990562bfSwiz.Nm 50667b5ea1Smycroft.Fl signal_name 5161f28255Scgd.Ar pid 5261f28255Scgd\&... 53990562bfSwiz.Nm 54667b5ea1Smycroft.Fl signal_number 5561f28255Scgd.Ar pid 5661f28255Scgd\&... 5761f28255Scgd.Sh DESCRIPTION 585118f5b2SadThe 595118f5b2Sad.Nm 605118f5b2Sadutility sends a signal to the process(es) specified 6161f28255Scgdby the pid operand(s). 6261f28255Scgd.Pp 6361f28255ScgdOnly the super-user may send signals to other users' processes. 6461f28255Scgd.Pp 6561f28255ScgdThe options are as follows: 6661f28255Scgd.Bl -tag -width Ds 67ef266ed8Swiz.It Fl s Ar signal_name 680ba34484SjtcA symbolic signal name specifying the signal to be sent instead of the 690ba34484Sjtcdefault 700ba34484Sjtc.Dv TERM . 71ac143322Swiz.It Fl l Op Ar exit_status 72acce89e7SwizDisplay the name of the signal corresponding to 73acce89e7Swiz.Ar exit_status . 74acce89e7Swiz.Ar exit_status 75acce89e7Swizmay be the exit status of a command killed by a signal 76acce89e7Swiz(see the 77acce89e7Swizspecial 78acce89e7Swiz.Xr sh 1 79acce89e7Swizparameter 80acce89e7Swiz.Sq ?\& ) 81acce89e7Swizor a signal number. 82acce89e7Swiz.Pp 83acce89e7SwizIf no operand is given, display the names of all the signals. 8412b01adfSwizIn 8512b01adfSwiz.Pa /bin/kill , 8612b01adfSwizif the variable 8712b01adfSwiz.Ev POSIXLY_CORRECT 88075741c0Skreis set in the environment, this uses the POSIX specified format, 89075741c0Skreotherwise a slightly more pleasing layout is used. 9061f28255Scgd.It Fl signal_name 9161f28255ScgdA symbolic signal name specifying the signal to be sent instead of the 9261f28255Scgddefault 9361f28255Scgd.Dv TERM . 9461f28255Scgd.It Fl signal_number 9561f28255ScgdA non-negative decimal integer, specifying the signal to be sent instead 9661f28255Scgdof the default 9761f28255Scgd.Dv TERM . 9861f28255Scgd.El 9961f28255Scgd.Pp 100538f7756SkreThe following 101538f7756Skre.Ar pid Ns s 102538f7756Skrehave special meanings: 103667b5ea1Smycroft.Bl -tag -width Ds -compact 104667b5ea1Smycroft.It -1 105667b5ea1SmycroftIf superuser, broadcast the signal to all processes; otherwise broadcast 106667b5ea1Smycroftto all processes belonging to the user. 1076dc4210bSkleink.It 0 1086dc4210bSkleinkBroadcast the signal to all processes in the current process group 1096dc4210bSkleinkbelonging to the user. 11061f28255Scgd.El 111538f7756SkreAny other negative 112538f7756Skre.Ar pid 113538f7756Skreis interpreted as the negative of a process group identifier, 114538f7756Skreand the signal is sent to all members of that group. 115538f7756Skre.Pp 116538f7756SkreNote that while not required by this implementation, 117538f7756Skreif the first 118538f7756Skre.Ar pid 119538f7756Skreoperand is negative, it should be preceded by the 120538f7756Skre.Dq \&-- 121538f7756Skreend of options indicator, to avoid the 122538f7756Skre.Ar pid 123538f7756Skrebeing treated as yet more options. 124538f7756SkreThat is always required if no specific signal is specified 125538f7756Skreand the first 126538f7756Skre.Ar pid 127538f7756Skreis negative, or that pid would be treated as the 128538f7756Skre.Ar signal_number . 129667b5ea1Smycroft.Pp 130667b5ea1SmycroftSome of the more commonly used signals: 131667b5ea1Smycroft.Bl -tag -width Ds -compact 132a5d88181Sriastradh.It 0 1335a222286Schristos0 (does not affect the process; can be used to test whether the 1345a222286Schristosprocess exists) 135667b5ea1Smycroft.It 1 136667b5ea1SmycroftHUP (hang up) 137667b5ea1Smycroft.It 2 138667b5ea1SmycroftINT (interrupt) 139667b5ea1Smycroft.It 3 140667b5ea1SmycroftQUIT (quit) 141667b5ea1Smycroft.It 6 142667b5ea1SmycroftABRT (abort) 143667b5ea1Smycroft.It 9 144667b5ea1SmycroftKILL (non-catchable, non-ignorable kill) 145667b5ea1Smycroft.It 14 146667b5ea1SmycroftALRM (alarm clock) 147667b5ea1Smycroft.It 15 148667b5ea1SmycroftTERM (software termination signal) 14945f67043Skre.It 17 15045f67043SkreSTOP (non-catchable, non-ignorable, causes process to temporarily stop, 15145f67043Skreafter which it can later be resumed using 15245f67043Skre.Dv SIGCONT ) 15345f67043Skre.It 19 154*ec52c873SandvarCONT (stopped processes resume execution) 155667b5ea1Smycroft.El 15661f28255Scgd.Pp 157c3872193Senami.Nm 15845f67043Skreis a built-in to most shells, 15945f67043Skreincluding 16045f67043Skre.Xr sh 1 16145f67043Skreand 16261f28255Scgd.Xr csh 1 ; 16361f28255Scgdit allows job specifiers of the form ``%...'' as arguments 16461f28255Scgdso process id's are not as often used as 165c3872193Senami.Nm 16661f28255Scgdarguments. 16761f28255ScgdSee 168538f7756Skre.Xr csh 1 , 16945f67043Skre.Xr sh 1 170538f7756Skreor the man page for the shell in use 17161f28255Scgdfor details. 172a5d88181Sriastradh.Sh DIAGNOSTICS 173a5d88181Sriastradh.Ex -std 17461f28255Scgd.Sh SEE ALSO 17561f28255Scgd.Xr csh 1 , 1765a6b9d89Sad.Xr pgrep 1 , 1775a6b9d89Sad.Xr pkill 1 , 17861f28255Scgd.Xr ps 1 , 17945f67043Skre.Xr sh 1 , 18061f28255Scgd.Xr kill 2 , 181a12da43aSjdolecek.Xr sigaction 2 , 182a12da43aSjdolecek.Xr signal 7 1830ba34484Sjtc.Sh STANDARDS 1840ba34484SjtcThe 185c3872193Senami.Nm 18640e3a09cSabhinavutility is expected to be 1870ba34484Sjtc.St -p1003.2 1880ba34484Sjtccompatible. 18961f28255Scgd.Sh HISTORY 19061f28255ScgdA 191c3872193Senami.Nm 19261f28255Scgdcommand appeared in 193a0ee124bSsevan.At v3 194a0ee124bSsevanin section 8 of the manual. 195b6547832SchristosThe original BSD description was: 196b6547832Schristos.Sq terminate a process with extreme prejudice . 197