PKILL(1)                         proctools 0.4                        PKILL(1)

NAME
     pkill - send signals to found processes

SYNOPSIS
     pkill [-signal] [-finvVx] [-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.

     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 anywhere in 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-existent
             numeric IDs do not cause errors.

     -i      Use case-insensitive pattern matching.

     -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.  Signals need not
             be preceded with a minus sign, but it is allowed.

     -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. Will print information about pro-
             cesses that do not match the given arguments.  As an exception,
             combining the -n option with the -v option will not invert the
             pattern match (only flags will be inverted).

     -V      Prints the pkill version, then quits.

     -x      Treat the pattern as a literal string for exact (full-string)
             matching. Without this option, the default is to match as an ex-
             tended regular expression.  N.b. the Solaris pgrep performs regu-
             lar expression matching in the presence of the -x option. This
             behaviour is considered redundant in this pkill implementation.
             The same effect may be achieved by avoiding the -x option and in-
             stead using a pattern of the form ^(pattern)$.

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.

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

     0 (EX_OK)
             One or more processes were matched.

     1       No processes were matched.

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

     69 (EX_UNAVAILABLE)
             An unexpected error occurred.

     70 (EX_SOFTWARE)
             A feature was not supported in the current environment.

     71 (EX_OSERR)
             A transient error occurred.

NOTES
     The current pkill process will not consider itself to be a potential
     match. However, it is possible for a user to construct a shell pipeline
     that contains processes that will be matched by the pattern supplied to
     this tool. Some users might not anticipate this.

     The output of this tool should never be treated as accurate programmatic
     input (process arguments will have been escaped for safe printing on the
     terminal).

     If a process has changed its displayed argument string, the -f option can
     be used to match against that string. Otherwise, the match will be per-
     formed against the executable name.

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.

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

HISTORY
     The original pkill command appeared in Sun Solaris 7.

AUTHORS
     Feedback may be sent to <wfaulk/users.sourceforge.net> and <j-de-
     venish/users.sourceforge.net>.  The project homepage is at <http://proc-
     tools.sourceforge.net>.

                               06 December 2003                              3