PKILL(1)                   OpenBSD Reference Manual                   PKILL(1)

NAME
     pkill - send signals to found processes

SYNOPSIS
     pkill [-signal] [-fnvVx] [-g pgrplist] [-G gidlist] [-P ppidlist] [-s
           signal] [-t termlist] [-u euidlist] [-U uidlist] [pattern]

DESCRIPTION
     The pkill utility sends a signal to process IDs for those processes that
     match the requirements specified on the command line.

     Processes are matched if the pattern, if given, matches the process's
     name, and the process matches any of the arguments given to all of the
     rest of the flags supplied on the command line.  The arguments supplied
     to pkill can be given as a comma and/or whitespace delimited list.  When
     given no options, pkill sends a signal to all user-mode processes.

     The options are as follows:

     -signal
             Specifies the signal to be sent to the matched processes.  De-
             faults to SIGTERM.  The signal can be specified as the name, with
             or without the prepended `SIG', or as a number.  This is a depre-
             cated way to specify options, but exists to match the kill(1)
             command.  When specified, it must appear as the first argument to
             pkill.

     -f      Match the pattern given against the full argument string of the
             process instead of just the executable name.

     -g pgrplist
             Match only processes that exist within the process groups speci-
             fied.

     -G gidlist
             Match only processes whose real group ID is listed.  Group IDs
             can be specified as group names and numeric IDs.  Non-existant
             numeric IDs do not cause errors.

     -l      Print the executable name of the process along with the process
             ID.

     -n      Print only the latest process that matches the rest of the argu-
             ments.  That is, the process that has the most recent start time.

     -P ppidlist
             Match only processes whose parent process ID is specified.

     -s signal
             Specifies the signal to be sent to the matched processes.  De-
             faults to SIGTERM.  The signal can be specified as the name, with
             or without the prepended `SIG', or as a number.

     -t termlist
             Match only processes whose controlling terminal is specified.
             Terminals can be specified as children of the /dev directory or,
             if starting with a leading slash (`/'), any currently mounted
             filename.  Filenames specified must be character devices.

     -u euidlist
             Match only processes whose effective user ID is given.  User IDs
             can be specified as usernames and as numeric user IDs.

     -U uidlist
             Match only processes whose real user ID is given.  User IDs can
             be specified as usernames and as numeric user IDs.

     -v      Invert the matching algorithm to print information about process
             that do not match the given arguments.

     -V      Invert the matching algorithm to print information about process
             that do not match the given flags but DO match the given pattern.
             Has no effect if only a pattern is given (the pattern will be
             matched as normal). Overrides -v if it is also given.  (OpenBSD
             extension.)

     -x      Make the pattern match be an exact match instead of a regular ex-
             pression.

EXAMPLES
     pkill sendmail

     Sends a SIGTERM signal to all sendmail processes.

     pkill -G daemon -v

     Sends a SIGTERM signal to all processes whose group ID is not daemon.

     pkill -9 -u root sh

     or

     pkill -u root -s 9 sh

     Sends signal 9 (SIGKILL) to all shells whose effective user ID is root.

SEE ALSO
     pgrep(1), ps(1), regex(3)

RETURN VALUES
     The pkill utility exits with one of the following values:

     0       One or more processes were matched.

     1       No processes were matched.

     64 (EX_USAGE)
             Invalid command-line options were specified.

HISTORY
     The pkill command first appeared in Sun Solaris 7.

     The -V flag first appeared in the OpenBSD 3.3 ports tree.

BUGS
     The original Solaris pkill could also match against session ID, but
     OpenBSD's session ID can fail to exist if the session leader exits.

     Also, the original Solaris version had only the deprecated -signal option
     to specify what signal to send.  This version can also use the -s signal
     option, which subsumes the session ID match listed above.

NOTES
     The current pkill process will never consider itself a potential match.


OpenBSD 3.5                     January 6, 2003                              2
