1.\" $NetBSD: pkill.1,v 1.16 2008/04/30 13:11:01 martin Exp $ 2.\" 3.\" Copyright (c) 2002 The NetBSD Foundation, Inc. 4.\" All rights reserved. 5.\" 6.\" This code is derived from software contributed to The NetBSD Foundation 7.\" by Andrew Doran. 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.\" 18.\" THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS 19.\" ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED 20.\" TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 21.\" PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS 22.\" BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 23.\" CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 24.\" SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 25.\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 26.\" CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 27.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 28.\" POSSIBILITY OF SUCH DAMAGE. 29.\" 30.Dd February 25, 2006 31.Dt PKILL 1 32.Os 33.Sh NAME 34.Nm pkill 35.Nd find or signal processes by name 36.Sh SYNOPSIS 37.Nm pgrep 38.Op Fl filnvx 39.Op Fl d Ar delim 40.Op Fl G Ar gid 41.Op Fl g Ar pgrp 42.Op Fl P Ar ppid 43.Op Fl s Ar sid 44.Op Fl t Ar tty 45.Op Fl U Ar uid 46.Op Fl u Ar euid 47.Op Ar pattern ... 48.Nm pkill 49.Op Fl signal 50.Op Fl finvx 51.Op Fl G Ar gid 52.Op Fl g Ar pgrp 53.Op Fl P Ar ppid 54.Op Fl s Ar sid 55.Op Fl t Ar tty 56.Op Fl U Ar uid 57.Op Fl u Ar euid 58.Op Ar pattern ... 59.Sh DESCRIPTION 60The 61.Nm pgrep 62command searches the process table on the running system and prints the 63process IDs of all processes that match the criteria given on the command 64line. 65.Pp 66The 67.Nm pkill 68command searches the process table on the running system and signals all 69processes that match the criteria given on the command line. 70.Pp 71The following options are available: 72.Bl -tag -width xxxxxxxx 73.It Fl d Ar delim 74Specify a delimiter to be printed between each process ID. 75The default is a newline. 76This option can only be used with the 77.Nm pgrep 78command. 79.It Fl f 80Match against full argument lists. 81The default is to match against process names. 82.It Fl G Ar gid 83Restrict matches to processes with a real group ID in the comma-separated 84list 85.Ar gid . 86.It Fl g Ar pgrp 87Restrict matches to processes with a process group ID in the comma-separated 88list 89.Ar pgrp . 90The value zero is taken to mean the process group ID of the running 91.Nm pgrep 92or 93.Nm pkill 94command. 95.It Fl i 96Ignore case distinctions in both the process table and the supplied pattern. 97.It Fl l 98Long output. 99Print the process name in addition to the process ID for each matching 100process. 101If used in conjunction with 102.Fl f , 103print the process ID and the full argument list for each matching process. 104.It Fl n 105Match only the most recently created process, if any. 106.It Fl P Ar ppid 107Restrict matches to processes with a parent process ID in the 108comma-separated list 109.Ar ppid . 110.It Fl s Ar sid 111Restrict matches to processes with a session ID in the comma-separated 112list 113.Ar sid . 114The value zero is taken to mean the session ID of the running 115.Nm pgrep 116or 117.Nm pkill 118command. 119.It Fl t Ar tty 120Restrict matches to processes associated with a terminal in the 121comma-separated list 122.Ar tty . 123Terminal names may be of the form 124.Sq ttyxx 125or the shortened form 126.Sq xx . 127A single dash 128.Pq Sq - 129matches processes not associated with a terminal. 130.It Fl U Ar uid 131Restrict matches to processes with a real user ID in the comma-separated 132list 133.Ar uid . 134.It Fl u Ar euid 135Restrict matches to processes with an effective user ID in the 136comma-separated list 137.Ar euid . 138.It Fl v 139Reverse the sense of the matching; display processes that do not match the 140given criteria. 141.It Fl x 142Require an exact match of the process name, or argument list if 143.Fl f 144is given. 145The default is to match any substring. 146.It Fl signal 147A non-negative decimal number or symbolic signal name specifying the signal 148to be sent instead of the default TERM. 149This option is valid only when given as the first argument to 150.Nm pkill . 151.El 152.Pp 153Note that a running 154.Nm pgrep 155or 156.Nm pkill 157process will never consider itself or system processes (kernel threads) as 158a potential match. 159.Sh EXIT STATUS 160.Nm pgrep 161and 162.Nm pkill 163return one of the following values upon exit: 164.Bl -tag -width foo 165.It 0 166One or more processes were matched. 167.It 1 168No processes were matched. 169.It 2 170Invalid options were specified on the command line. 171.It 3 172An internal error occurred. 173.El 174.Sh SEE ALSO 175.Xr grep 1 , 176.Xr kill 1 , 177.Xr ps 1 , 178.Xr kill 2 , 179.Xr sigaction 2 , 180.Xr re_format 7 , 181.Xr signal 7 182.Sh HISTORY 183.Nm pkill 184and 185.Nm pgrep 186first appeared in 187.Nx 1.6 . 188They are modelled after utilities of the same name that appeared in Sun 189Solaris 7. 190