Home Explore Blog CI



man-pages

1st chunk of `pkill.man`
899be73ca5a14e2f91e998c883a4098cc6765a9bb875ba210000000100000fb6
PGREP(1)                         User Commands                         PGREP(1)

NAME
       pgrep,  pkill, pidwait - look up, signal, or wait for processes based on
       name and other attributes

SYNOPSIS
       pgrep [options] pattern
       pkill [options] pattern
       pidwait [options] pattern

DESCRIPTION
       pgrep looks through  the  currently  running  processes  and  lists  the
       process  IDs which match the selection criteria to stdout.  All the cri‐
       teria have to match.  For example,

              $ pgrep -u root sshd

       will only list the processes called sshd AND  owned  by  root.   On  the
       other hand,

              $ pgrep -u root,daemon

       will list the processes owned by root OR daemon.

       pkill  will  send  the  specified  signal  (by  default SIGTERM) to each
       process instead of listing them on stdout.

       pidwait will wait for each process instead of listing them on stdout.

OPTIONS
       -signal
       --signal signal
              Defines the signal to send to each matched process.   Either  the
              numeric or the symbolic signal name can be used. In pgrep or pid‐
              wait  mode  this  has  no  effect unless used in conjunction with
              --require-handler to filter to processes with a userspace  signal
              handler present for a particular signal.

       -c, --count
              Suppress  normal  output;  instead  print  a  count  of  matching
              processes.  When count does  not  match  anything,  e.g.  returns
              zero, the command will return non‐zero value. Note that for pkill
              and  pidwait,  the count is the number of matching processes, not
              the processes that were successfully signaled or waited for.

       -d, --delimiter delimiter
              Sets the string used to delimit each process ID in the output (by
              default a newline).  (pgrep only.)

       -e, --echo
              Display name and PID of the process being killed.  (pkill only.)

       -f, --full
              The pattern is normally only matched against  the  process  name.
              When -f is set, the full command line is used.

       -g, --pgroup pgrp,...
              Only  match  processes  in the process group IDs listed.  Process
              group 0 is translated into pgrep’s,  pkill’s,  or  pidwait’s  own
              process group.

       -G, --group gid,...
              Only  match  processes whose real group ID is listed.  Either the
              numerical or symbolical value may be used.

       -i, --ignore-case
              Match processes case‐insensitively.

       -l, --list-name
              List the process name as well as the process ID.  (pgrep only.)

       -a, --list-full
              List the full command line as well as  the  process  ID.   (pgrep
              only.)

       -n, --newest
              Select  only  the  newest (most recently started) of the matching
              processes.

       -o, --oldest
              Select only the oldest (least recently started) of  the  matching
              processes.

       -O, --older secs
              Select processes older than secs.

       -P, --parent ppid,...
              Only match processes whose parent process ID is listed.

       -s, --session sid,...
              Only match processes whose process session ID is listed.  Session
              ID  0  is translated into pgrep’s, pkill’s, or pidwait’s own ses‐
              sion ID.

       -t, --terminal term,...
              Only match processes whose controlling terminal is  listed.   The
              terminal name should be specified without the "/dev/" prefix.

       -u, --euid euid,...
              Only  match  processes whose effective user ID is listed.  Either
              the numerical or symbolical value may be used.

       -U, --uid uid,...
              Only match processes whose real user ID is  listed.   Either 

Title: pgrep, pkill, pidwait - Look Up, Signal, or Wait for Processes
Summary
The pgrep, pkill, and pidwait commands are used to find, signal, or wait for processes based on their name and other attributes. pgrep lists process IDs, pkill sends signals to processes, and pidwait waits for processes to complete. The commands accept various options to filter processes based on user, group, terminal, and other criteria. Options also control the output format and signaling behavior.