[BACK]Return to pkill.1 CVS log [TXT][DIR] Up to [local] / src / usr.bin / pkill

Annotation of src/usr.bin/pkill/pkill.1, Revision 1.12

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