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

1.17    ! lum         1: .\"    $OpenBSD: pkill.1,v 1.16 2010/09/29 07:44:56 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.17    ! lum        31: .Dd $Mdocdate: September 29 2010 $
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.17    ! lum        51: .Op Fl flnovx
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 ,
1.17    ! lum       102: print the process ID and the full argument list for each matching process
        !           103: .Pf ( Nm pgrep
        !           104: only).
1.1       millert   105: .It Fl n
1.10      millert   106: Match only the most recently created (newest) process, if any.
1.13      sobrado   107: Cannot be used in conjunction with
1.10      millert   108: .Fl o .
                    109: .It Fl o
                    110: Match only the least recently created (oldest) process, if any.
1.13      sobrado   111: Cannot be used in conjunction with
1.10      millert   112: .Fl n .
1.6       jmc       113: .It Fl P Ar ppid
                    114: Restrict matches to processes with a parent process ID in the
                    115: comma-separated list
                    116: .Ar ppid .
1.1       millert   117: .It Fl s Ar sid
                    118: Restrict matches to processes with a session ID in the comma-separated
                    119: list
                    120: .Ar sid .
                    121: The value zero is taken to mean the session ID of the running
                    122: .Nm pgrep
                    123: or
                    124: .Nm pkill
                    125: command.
                    126: .It Fl t Ar tty
                    127: Restrict matches to processes associated with a terminal in the
                    128: comma-separated list
                    129: .Ar tty .
                    130: Terminal names may be of the form
                    131: .Sq ttyxx
                    132: or the shortened form
                    133: .Sq xx .
1.7       jmc       134: A single dash
                    135: .Pq Sq -
                    136: matches processes not associated with a terminal.
1.6       jmc       137: .It Fl U Ar uid
                    138: Restrict matches to processes with a real user ID in the comma-separated
                    139: list
                    140: .Ar uid .
1.1       millert   141: .It Fl u Ar euid
                    142: Restrict matches to processes with an effective user ID in the
                    143: comma-separated list
                    144: .Ar euid .
                    145: .It Fl v
1.14      jmc       146: Reverse the sense of the matching;
                    147: display or signal processes that do not match the given criteria.
1.1       millert   148: .It Fl x
                    149: Require an exact match of the process name, or argument list if
                    150: .Fl f
                    151: is given.
                    152: The default is to match any substring.
1.9       jmc       153: .It Fl Ar signal
1.1       millert   154: A non-negative decimal number or symbolic signal name specifying the signal
                    155: to be sent instead of the default TERM.
                    156: This option is valid only when given as the first argument to
                    157: .Nm pkill .
                    158: .El
1.15      jmc       159: .Pp
                    160: If any
                    161: .Ar pattern
                    162: operands are specified, they are used as
                    163: regular expressions to match the command name
                    164: or, if
                    165: .Fl f
                    166: is specified, the full argument list of each process.
                    167: However, presently
                    168: .Ox
                    169: will only keep track of the first 16 characters of the command name
                    170: for each process.
                    171: Attempts to match any characters after the first 16 of a
                    172: command name will silently fail.
1.1       millert   173: .Pp
                    174: Note that a running
                    175: .Nm pgrep
                    176: or
                    177: .Nm pkill
1.7       jmc       178: process will never consider itself or system processes (kernel threads) as
1.1       millert   179: a potential match.
1.16      jmc       180: .Sh EXIT STATUS
                    181: The
1.1       millert   182: .Nm pgrep
                    183: and
                    184: .Nm pkill
1.16      jmc       185: utilities exit with one of the following values:
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 .