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