[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.15

1.15    ! jmc         1: .\"    $OpenBSD: pkill.1,v 1.14 2009/06/07 22:16:43 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.15    ! jmc        31: .Dd $Mdocdate: June 7 2009 $
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.
1.13      sobrado   108: Cannot be used in conjunction with
1.10      millert   109: .Fl o .
                    110: .It Fl o
                    111: Match only the least recently created (oldest) process, if any.
1.13      sobrado   112: Cannot be used in conjunction with
1.10      millert   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
1.14      jmc       147: Reverse the sense of the matching;
                    148: display or signal processes that do not match the given criteria.
1.1       millert   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
1.15    ! jmc       160: .Pp
        !           161: If any
        !           162: .Ar pattern
        !           163: operands are specified, they are used as
        !           164: regular expressions to match the command name
        !           165: or, if
        !           166: .Fl f
        !           167: is specified, the full argument list of each process.
        !           168: However, presently
        !           169: .Ox
        !           170: will only keep track of the first 16 characters of the command name
        !           171: for each process.
        !           172: Attempts to match any characters after the first 16 of a
        !           173: command name will silently fail.
1.1       millert   174: .Pp
                    175: Note that a running
                    176: .Nm pgrep
                    177: or
                    178: .Nm pkill
1.7       jmc       179: process will never consider itself or system processes (kernel threads) as
1.1       millert   180: a potential match.
1.7       jmc       181: .Pp
1.1       millert   182: .Nm pgrep
                    183: and
                    184: .Nm pkill
                    185: return one of the following values upon exit:
1.7       jmc       186: .Pp
                    187: .Bl -tag -width Ds -offset indent -compact
1.1       millert   188: .It 0
                    189: One or more processes were matched.
                    190: .It 1
                    191: No processes were matched.
                    192: .It 2
                    193: Invalid options were specified on the command line.
                    194: .It 3
                    195: An internal error occurred.
                    196: .El
                    197: .Sh SEE ALSO
1.7       jmc       198: .Xr grep 1 ,
1.1       millert   199: .Xr kill 1 ,
                    200: .Xr ps 1 ,
                    201: .Xr kill 2 ,
                    202: .Xr sigaction 2 ,
1.2       millert   203: .Xr re_format 7
1.1       millert   204: .Sh HISTORY
                    205: .Nm pkill
                    206: and
                    207: .Nm pgrep
                    208: first appeared in
                    209: .Ox 3.5 .
                    210: They are modelled after utilities of the same name that appeared in Sun
                    211: Solaris 7.
                    212: .Sh AUTHORS
                    213: .An Andrew Doran
                    214: .Aq ad@NetBSD.org .