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

1.20    ! ajacouto    1: .\"    $OpenBSD: pkill.1,v 1.19 2012/08/21 06:28:36 espie 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.20    ! ajacouto   31: .Dd $Mdocdate: August 21 2012 $
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.19      espie      39: .Op Fl flnoqvx
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
1.18      markus     45: .Op Fl T Ar rtable
1.1       millert    46: .Op Fl t Ar tty
1.6       jmc        47: .Op Fl U Ar uid
1.1       millert    48: .Op Fl u Ar euid
1.6       jmc        49: .Op Ar pattern ...
1.1       millert    50: .Nm pkill
1.9       jmc        51: .Op Fl Ar signal
1.19      espie      52: .Op Fl flnoqvx
1.1       millert    53: .Op Fl G Ar gid
1.6       jmc        54: .Op Fl g Ar pgrp
1.1       millert    55: .Op Fl P Ar ppid
                     56: .Op Fl s Ar sid
1.18      markus     57: .Op Fl T Ar rtable
1.1       millert    58: .Op Fl t Ar tty
1.6       jmc        59: .Op Fl U Ar uid
1.1       millert    60: .Op Fl u Ar euid
1.6       jmc        61: .Op Ar pattern ...
1.1       millert    62: .Sh DESCRIPTION
                     63: The
                     64: .Nm pgrep
                     65: command searches the process table on the running system and prints the
                     66: process IDs of all processes that match the criteria given on the command
                     67: line.
                     68: .Pp
                     69: The
                     70: .Nm pkill
                     71: command searches the process table on the running system and signals all
                     72: processes that match the criteria given on the command line.
                     73: .Pp
                     74: The following options are available:
1.7       jmc        75: .Bl -tag -width Ds
1.1       millert    76: .It Fl d Ar delim
                     77: Specify a delimiter to be printed between each process ID.
                     78: The default is a newline.
                     79: This option can only be used with the
                     80: .Nm pgrep
                     81: command.
                     82: .It Fl f
                     83: Match against full argument lists.
                     84: The default is to match against process names.
1.6       jmc        85: .It Fl G Ar gid
                     86: Restrict matches to processes with a real group ID in the comma-separated
                     87: list
                     88: .Ar gid .
1.1       millert    89: .It Fl g Ar pgrp
                     90: Restrict matches to processes with a process group ID in the comma-separated
                     91: list
                     92: .Ar pgrp .
                     93: The value zero is taken to mean the process group ID of the running
                     94: .Nm pgrep
                     95: or
                     96: .Nm pkill
                     97: command.
                     98: .It Fl l
                     99: Long output.
                    100: Print the process name in addition to the process ID for each matching
                    101: process.
                    102: If used in conjunction with
                    103: .Fl f ,
1.17      lum       104: print the process ID and the full argument list for each matching process
                    105: .Pf ( Nm pgrep
                    106: only).
1.1       millert   107: .It Fl n
1.10      millert   108: Match only the most recently created (newest) process, if any.
1.13      sobrado   109: Cannot be used in conjunction with
1.10      millert   110: .Fl o .
                    111: .It Fl o
                    112: Match only the least recently created (oldest) process, if any.
1.13      sobrado   113: Cannot be used in conjunction with
1.10      millert   114: .Fl n .
1.6       jmc       115: .It Fl P Ar ppid
                    116: Restrict matches to processes with a parent process ID in the
                    117: comma-separated list
                    118: .Ar ppid .
1.20    ! ajacouto  119: .It Fl q
        !           120: Quiet mode.
        !           121: Perform the action, but don't display anything on standard output.
        !           122: Note that
        !           123: .Fl q
        !           124: takes precedence over other display options such as
        !           125: .Fl l .
1.1       millert   126: .It Fl s Ar sid
                    127: Restrict matches to processes with a session ID in the comma-separated
                    128: list
                    129: .Ar sid .
                    130: The value zero is taken to mean the session ID of the running
                    131: .Nm pgrep
                    132: or
                    133: .Nm pkill
                    134: command.
1.18      markus    135: .It Fl T Ar rtable
                    136: Restrict matches to processes associated with the specified routing tables
                    137: in the comma-separated list
                    138: .Ar rtable .
1.1       millert   139: .It Fl t Ar tty
                    140: Restrict matches to processes associated with a terminal in the
                    141: comma-separated list
                    142: .Ar tty .
                    143: Terminal names may be of the form
                    144: .Sq ttyxx
                    145: or the shortened form
                    146: .Sq xx .
1.7       jmc       147: A single dash
                    148: .Pq Sq -
                    149: matches processes not associated with a terminal.
1.6       jmc       150: .It Fl U Ar uid
                    151: Restrict matches to processes with a real user ID in the comma-separated
                    152: list
                    153: .Ar uid .
1.1       millert   154: .It Fl u Ar euid
                    155: Restrict matches to processes with an effective user ID in the
                    156: comma-separated list
                    157: .Ar euid .
                    158: .It Fl v
1.14      jmc       159: Reverse the sense of the matching;
                    160: display or signal processes that do not match the given criteria.
1.1       millert   161: .It Fl x
                    162: Require an exact match of the process name, or argument list if
                    163: .Fl f
                    164: is given.
                    165: The default is to match any substring.
1.9       jmc       166: .It Fl Ar signal
1.1       millert   167: A non-negative decimal number or symbolic signal name specifying the signal
                    168: to be sent instead of the default TERM.
                    169: This option is valid only when given as the first argument to
                    170: .Nm pkill .
                    171: .El
1.15      jmc       172: .Pp
                    173: If any
                    174: .Ar pattern
                    175: operands are specified, they are used as
                    176: regular expressions to match the command name
                    177: or, if
                    178: .Fl f
                    179: is specified, the full argument list of each process.
                    180: However, presently
                    181: .Ox
                    182: will only keep track of the first 16 characters of the command name
                    183: for each process.
                    184: Attempts to match any characters after the first 16 of a
                    185: command name will silently fail.
1.1       millert   186: .Pp
                    187: Note that a running
                    188: .Nm pgrep
                    189: or
                    190: .Nm pkill
1.7       jmc       191: process will never consider itself or system processes (kernel threads) as
1.1       millert   192: a potential match.
1.16      jmc       193: .Sh EXIT STATUS
                    194: The
1.1       millert   195: .Nm pgrep
                    196: and
                    197: .Nm pkill
1.16      jmc       198: utilities exit with one of the following values:
1.7       jmc       199: .Pp
                    200: .Bl -tag -width Ds -offset indent -compact
1.1       millert   201: .It 0
                    202: One or more processes were matched.
                    203: .It 1
                    204: No processes were matched.
                    205: .It 2
                    206: Invalid options were specified on the command line.
                    207: .It 3
                    208: An internal error occurred.
                    209: .El
                    210: .Sh SEE ALSO
1.7       jmc       211: .Xr grep 1 ,
1.1       millert   212: .Xr kill 1 ,
                    213: .Xr ps 1 ,
                    214: .Xr kill 2 ,
                    215: .Xr sigaction 2 ,
1.2       millert   216: .Xr re_format 7
1.1       millert   217: .Sh HISTORY
                    218: .Nm pkill
                    219: and
                    220: .Nm pgrep
                    221: first appeared in
                    222: .Ox 3.5 .
                    223: They are modelled after utilities of the same name that appeared in Sun
                    224: Solaris 7.
                    225: .Sh AUTHORS
                    226: .An Andrew Doran
                    227: .Aq ad@NetBSD.org .