{
    "content": [
        {
            "type": "text",
            "text": "# pidwait (man)\n\n## NAME\n\npgrep,  pkill,  pidwait  - look up, signal, or wait for processes based on name and other at‐ tributes\n\n## SYNOPSIS\n\npgrep [options] pattern\npkill [options] pattern\npidwait [options] pattern\n\n## DESCRIPTION\n\npgrep looks through the currently running processes and lists the process IDs which match the\nselection criteria to stdout.  All the criteria have to match.  For example,\n\n## Sections\n\n- **NAME**\n- **SYNOPSIS**\n- **DESCRIPTION**\n- **OPTIONS** (29 subsections)\n- **OPERANDS**\n- **EXAMPLES**\n- **EXIT STATUS**\n- **NOTES**\n- **BUGS**\n- **SEE ALSO**\n- **AUTHOR**\n- **REPORTING BUGS**\n\nUse structuredContent.sections for detailed options, examples, and full documentation.\n"
        }
    ],
    "structuredContent": {
        "command": "pidwait",
        "section": "",
        "mode": "man",
        "summary": "pgrep,  pkill,  pidwait  - look up, signal, or wait for processes based on name and other at‐ tributes",
        "synopsis": "pgrep [options] pattern\npkill [options] pattern\npidwait [options] pattern",
        "tldr_summary": null,
        "tldr_examples": [],
        "tldr_source": null,
        "flags": [
            {
                "flag": "",
                "long": null,
                "arg": null,
                "description": "--signal signal Defines the signal to send to each matched process. Either the numeric or the sym‐ bolic signal name can be used. In pgrep or pidwait mode only the long option can be used and has no effect unless used in conjunction with --require-handler to filter to processes with a userspace signal handler present for a particular signal."
            },
            {
                "flag": "-c",
                "long": "--count",
                "arg": null,
                "description": "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."
            },
            {
                "flag": "-d",
                "long": "--delimiter",
                "arg": null,
                "description": "Sets the string used to delimit each process ID in the output (by default a newline). (pgrep only.)"
            },
            {
                "flag": "-e",
                "long": "--echo",
                "arg": null,
                "description": "Display name and PID of the process being killed. (pkill only.)"
            },
            {
                "flag": "-f",
                "long": "--full",
                "arg": null,
                "description": "The pattern is normally only matched against the process name. When -f is set, the full command line is used."
            },
            {
                "flag": "-g",
                "long": "--pgroup",
                "arg": null,
                "description": "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."
            },
            {
                "flag": "-G",
                "long": "--group",
                "arg": null,
                "description": "Only match processes whose real group ID is listed. Either the numerical or symboli‐ cal value may be used."
            },
            {
                "flag": "-i",
                "long": "--ignore-case",
                "arg": null,
                "description": "Match processes case-insensitively."
            },
            {
                "flag": "-l",
                "long": "--list-name",
                "arg": null,
                "description": "List the process name as well as the process ID. (pgrep only.)"
            },
            {
                "flag": "-a",
                "long": "--list-full",
                "arg": null,
                "description": "List the full command line as well as the process ID. (pgrep only.)"
            },
            {
                "flag": "-n",
                "long": "--newest",
                "arg": null,
                "description": "Select only the newest (most recently started) of the matching processes."
            },
            {
                "flag": "-o",
                "long": "--oldest",
                "arg": null,
                "description": "Select only the oldest (least recently started) of the matching processes."
            },
            {
                "flag": "-O",
                "long": "--older",
                "arg": null,
                "description": "Select processes older than secs."
            },
            {
                "flag": "-P",
                "long": "--parent",
                "arg": null,
                "description": "Only match processes whose parent process ID is listed."
            },
            {
                "flag": "-s",
                "long": "--session",
                "arg": null,
                "description": "Only match processes whose process session ID is listed. Session ID 0 is translated into pgrep's, pkill's, or pidwait's own session ID."
            },
            {
                "flag": "-t",
                "long": "--terminal",
                "arg": null,
                "description": "Only match processes whose controlling terminal is listed. The terminal name should be specified without the \"/dev/\" prefix."
            },
            {
                "flag": "-u",
                "long": "--euid",
                "arg": null,
                "description": "Only match processes whose effective user ID is listed. Either the numerical or sym‐ bolical value may be used."
            },
            {
                "flag": "-U",
                "long": "--uid",
                "arg": null,
                "description": "Only match processes whose real user ID is listed. Either the numerical or symbolical value may be used."
            },
            {
                "flag": "-v",
                "long": "--inverse",
                "arg": null,
                "description": "Negates the matching. This option is usually used in pgrep's or pidwait's context. In pkill's context the short option is disabled to avoid accidental usage of the op‐ tion."
            },
            {
                "flag": "-w",
                "long": "--lightweight",
                "arg": null,
                "description": "Shows all thread ids instead of pids in pgrep's or pidwait's context. In pkill's con‐ text this option is disabled."
            },
            {
                "flag": "-x",
                "long": "--exact",
                "arg": null,
                "description": "Only match processes whose names (or command lines if -f is specified) exactly match the pattern."
            },
            {
                "flag": "-F",
                "long": "--pidfile",
                "arg": null,
                "description": "Read PIDs from file. This option is more useful for pkill or pidwait than pgrep."
            },
            {
                "flag": "-L",
                "long": "--logpidfile",
                "arg": null,
                "description": "Fail if pidfile (see -F) not locked."
            },
            {
                "flag": "-r",
                "long": "--runstates",
                "arg": null,
                "description": "Match only processes which match the process state."
            },
            {
                "flag": "-A",
                "long": "--ignore-ancestors",
                "arg": null,
                "description": "Ignore all ancestors of pgrep, pkill, or pidwait. For example, this can be useful when elevating with sudo or similar tools."
            },
            {
                "flag": "-H",
                "long": "--require-handler",
                "arg": null,
                "description": "Only match processes with a userspace signal handler present for the signal to be sent. --cgroup name,... Match on provided control group (cgroup) v2 name. See cgroups(8) --ns pid Match processes that belong to the same namespaces. Required to run as root to match processes from other users. See --nslist for how to limit which namespaces to match. --nslist name,... Match only the provided namespaces. Available namespaces: ipc, mnt, net, pid, user, uts."
            },
            {
                "flag": "-q",
                "long": "--queue",
                "arg": null,
                "description": "Use sigqueue(3) rather than kill(2) and the value argument is used to specify an inte‐ ger to be sent with the signal. If the receiving process has installed a handler for this signal using the SASIGINFO flag to sigaction(2), then it can obtain this data via the sivalue field of the siginfot structure."
            },
            {
                "flag": "-V",
                "long": "--version",
                "arg": null,
                "description": "Display version information and exit."
            },
            {
                "flag": "-h",
                "long": "--help",
                "arg": null,
                "description": "Display help and exit."
            }
        ],
        "examples": [
            "Example 1: Find the process ID of the named daemon:",
            "$ pgrep -u root named",
            "Example 2: Make syslog reread its configuration file:",
            "$ pkill -HUP syslogd",
            "Example 3: Give detailed information on all xterm processes:",
            "$ ps -fp $(pgrep -d, -x xterm)",
            "Example 4: Make all chrome processes run nicer:",
            "$ renice +4 $(pgrep chrome)"
        ],
        "see_also": [
            {
                "name": "ps",
                "section": "1",
                "url": "https://www.chedong.com/phpMan.php/man/ps/1/json"
            },
            {
                "name": "regex",
                "section": "7",
                "url": "https://www.chedong.com/phpMan.php/man/regex/7/json"
            },
            {
                "name": "signal",
                "section": "7",
                "url": "https://www.chedong.com/phpMan.php/man/signal/7/json"
            },
            {
                "name": "sigqueue",
                "section": "3",
                "url": "https://www.chedong.com/phpMan.php/man/sigqueue/3/json"
            },
            {
                "name": "killall",
                "section": "1",
                "url": "https://www.chedong.com/phpMan.php/man/killall/1/json"
            },
            {
                "name": "skill",
                "section": "1",
                "url": "https://www.chedong.com/phpMan.php/man/skill/1/json"
            },
            {
                "name": "kill",
                "section": "1",
                "url": "https://www.chedong.com/phpMan.php/man/kill/1/json"
            },
            {
                "name": "kill",
                "section": "2",
                "url": "https://www.chedong.com/phpMan.php/man/kill/2/json"
            },
            {
                "name": "cgroups",
                "section": "8",
                "url": "https://www.chedong.com/phpMan.php/man/cgroups/8/json"
            }
        ],
        "section_outline": [
            {
                "name": "NAME",
                "lines": 3,
                "subsections": []
            },
            {
                "name": "SYNOPSIS",
                "lines": 4,
                "subsections": []
            },
            {
                "name": "DESCRIPTION",
                "lines": 16,
                "subsections": []
            },
            {
                "name": "OPTIONS",
                "lines": 1,
                "subsections": [
                    {
                        "name": "-_",
                        "lines": 7
                    },
                    {
                        "name": "-c --count",
                        "lines": 5,
                        "flag": "-c",
                        "long": "--count"
                    },
                    {
                        "name": "-d --delimiter _",
                        "lines": 3,
                        "flag": "-d",
                        "long": "--delimiter"
                    },
                    {
                        "name": "-e --echo",
                        "lines": 2,
                        "flag": "-e",
                        "long": "--echo"
                    },
                    {
                        "name": "-f --full",
                        "lines": 3,
                        "flag": "-f",
                        "long": "--full"
                    },
                    {
                        "name": "-g --pgroup _",
                        "lines": 3,
                        "flag": "-g",
                        "long": "--pgroup"
                    },
                    {
                        "name": "-G --group _",
                        "lines": 3,
                        "flag": "-G",
                        "long": "--group"
                    },
                    {
                        "name": "-i --ignore-case",
                        "lines": 2,
                        "flag": "-i",
                        "long": "--ignore-case"
                    },
                    {
                        "name": "-l --list-name",
                        "lines": 2,
                        "flag": "-l",
                        "long": "--list-name"
                    },
                    {
                        "name": "-a --list-full",
                        "lines": 2,
                        "flag": "-a",
                        "long": "--list-full"
                    },
                    {
                        "name": "-n --newest",
                        "lines": 2,
                        "flag": "-n",
                        "long": "--newest"
                    },
                    {
                        "name": "-o --oldest",
                        "lines": 2,
                        "flag": "-o",
                        "long": "--oldest"
                    },
                    {
                        "name": "-O --older _",
                        "lines": 2,
                        "flag": "-O",
                        "long": "--older"
                    },
                    {
                        "name": "-P --parent _",
                        "lines": 2,
                        "flag": "-P",
                        "long": "--parent"
                    },
                    {
                        "name": "-s --session _",
                        "lines": 3,
                        "flag": "-s",
                        "long": "--session"
                    },
                    {
                        "name": "-t --terminal _",
                        "lines": 3,
                        "flag": "-t",
                        "long": "--terminal"
                    },
                    {
                        "name": "-u --euid _",
                        "lines": 3,
                        "flag": "-u",
                        "long": "--euid"
                    },
                    {
                        "name": "-U --uid _",
                        "lines": 3,
                        "flag": "-U",
                        "long": "--uid"
                    },
                    {
                        "name": "-v --inverse",
                        "lines": 4,
                        "flag": "-v",
                        "long": "--inverse"
                    },
                    {
                        "name": "-w --lightweight",
                        "lines": 3,
                        "flag": "-w",
                        "long": "--lightweight"
                    },
                    {
                        "name": "-x --exact",
                        "lines": 3,
                        "flag": "-x",
                        "long": "--exact"
                    },
                    {
                        "name": "-F --pidfile _",
                        "lines": 2,
                        "flag": "-F",
                        "long": "--pidfile"
                    },
                    {
                        "name": "-L --logpidfile",
                        "lines": 2,
                        "flag": "-L",
                        "long": "--logpidfile"
                    },
                    {
                        "name": "-r --runstates _",
                        "lines": 2,
                        "flag": "-r",
                        "long": "--runstates"
                    },
                    {
                        "name": "-A --ignore-ancestors",
                        "lines": 3,
                        "flag": "-A",
                        "long": "--ignore-ancestors"
                    },
                    {
                        "name": "-H --require-handler",
                        "lines": 14,
                        "flag": "-H",
                        "long": "--require-handler"
                    },
                    {
                        "name": "-q --queue _",
                        "lines": 5,
                        "flag": "-q",
                        "long": "--queue"
                    },
                    {
                        "name": "-V --version",
                        "lines": 2,
                        "flag": "-V",
                        "long": "--version"
                    },
                    {
                        "name": "-h --help",
                        "lines": 2,
                        "flag": "-h",
                        "long": "--help"
                    }
                ]
            },
            {
                "name": "OPERANDS",
                "lines": 4,
                "subsections": []
            },
            {
                "name": "EXAMPLES",
                "lines": 16,
                "subsections": []
            },
            {
                "name": "EXIT STATUS",
                "lines": 6,
                "subsections": []
            },
            {
                "name": "NOTES",
                "lines": 9,
                "subsections": []
            },
            {
                "name": "BUGS",
                "lines": 6,
                "subsections": []
            },
            {
                "name": "SEE ALSO",
                "lines": 2,
                "subsections": []
            },
            {
                "name": "AUTHOR",
                "lines": 2,
                "subsections": []
            },
            {
                "name": "REPORTING BUGS",
                "lines": 3,
                "subsections": []
            }
        ],
        "sections": {
            "NAME": {
                "content": "pgrep,  pkill,  pidwait  - look up, signal, or wait for processes based on name and other at‐\ntributes\n",
                "subsections": []
            },
            "SYNOPSIS": {
                "content": "pgrep [options] pattern\npkill [options] pattern\npidwait [options] pattern\n",
                "subsections": []
            },
            "DESCRIPTION": {
                "content": "pgrep looks through the currently running processes and lists the process IDs which match the\nselection criteria to stdout.  All the criteria have to match.  For example,\n\n$ pgrep -u root sshd\n\nwill only list the processes called sshd AND owned by root.  On the other hand,\n\n$ pgrep -u root,daemon\n\nwill list the processes owned by root OR daemon.\n\npkill will send the specified signal (by default SIGTERM) to each process instead of  listing\nthem on stdout.\n\npidwait will wait for each process instead of listing them on stdout.\n",
                "subsections": []
            },
            "OPTIONS": {
                "content": "",
                "subsections": [
                    {
                        "name": "-_",
                        "content": "--signal signal\nDefines  the  signal  to send to each matched process.  Either the numeric or the sym‐\nbolic signal name can be used. In pgrep or pidwait mode only the long  option  can  be\nused  and has no effect unless used in conjunction with --require-handler to filter to\nprocesses with a userspace signal handler present for a particular signal.\n\n"
                    },
                    {
                        "name": "-c --count",
                        "content": "Suppress normal output; instead print a count of matching processes.  When count  does\nnot  match  anything,  e.g. returns zero, the command will return non-zero value. Note\nthat for pkill and pidwait, the count is the number of  matching  processes,  not  the\nprocesses that were successfully signaled or waited for.\n",
                        "flag": "-c",
                        "long": "--count"
                    },
                    {
                        "name": "-d --delimiter _",
                        "content": "Sets  the string used to delimit each process ID in the output (by default a newline).\n(pgrep only.)\n",
                        "flag": "-d",
                        "long": "--delimiter"
                    },
                    {
                        "name": "-e --echo",
                        "content": "Display name and PID of the process being killed.  (pkill only.)\n",
                        "flag": "-e",
                        "long": "--echo"
                    },
                    {
                        "name": "-f --full",
                        "content": "The pattern is normally only matched against the process name.  When -f  is  set,  the\nfull command line is used.\n",
                        "flag": "-f",
                        "long": "--full"
                    },
                    {
                        "name": "-g --pgroup _",
                        "content": "Only  match  processes in the process group IDs listed.  Process group 0 is translated\ninto pgrep's, pkill's, or pidwait's own process group.\n",
                        "flag": "-g",
                        "long": "--pgroup"
                    },
                    {
                        "name": "-G --group _",
                        "content": "Only match processes whose real group ID is listed.  Either the numerical or  symboli‐\ncal value may be used.\n",
                        "flag": "-G",
                        "long": "--group"
                    },
                    {
                        "name": "-i --ignore-case",
                        "content": "Match processes case-insensitively.\n",
                        "flag": "-i",
                        "long": "--ignore-case"
                    },
                    {
                        "name": "-l --list-name",
                        "content": "List the process name as well as the process ID.  (pgrep only.)\n",
                        "flag": "-l",
                        "long": "--list-name"
                    },
                    {
                        "name": "-a --list-full",
                        "content": "List the full command line as well as the process ID.  (pgrep only.)\n",
                        "flag": "-a",
                        "long": "--list-full"
                    },
                    {
                        "name": "-n --newest",
                        "content": "Select only the newest (most recently started) of the matching processes.\n",
                        "flag": "-n",
                        "long": "--newest"
                    },
                    {
                        "name": "-o --oldest",
                        "content": "Select only the oldest (least recently started) of the matching processes.\n",
                        "flag": "-o",
                        "long": "--oldest"
                    },
                    {
                        "name": "-O --older _",
                        "content": "Select processes older than secs.\n",
                        "flag": "-O",
                        "long": "--older"
                    },
                    {
                        "name": "-P --parent _",
                        "content": "Only match processes whose parent process ID is listed.\n",
                        "flag": "-P",
                        "long": "--parent"
                    },
                    {
                        "name": "-s --session _",
                        "content": "Only  match  processes whose process session ID is listed.  Session ID 0 is translated\ninto pgrep's, pkill's, or pidwait's own session ID.\n",
                        "flag": "-s",
                        "long": "--session"
                    },
                    {
                        "name": "-t --terminal _",
                        "content": "Only match processes whose controlling terminal is listed.  The terminal  name  should\nbe specified without the \"/dev/\" prefix.\n",
                        "flag": "-t",
                        "long": "--terminal"
                    },
                    {
                        "name": "-u --euid _",
                        "content": "Only  match processes whose effective user ID is listed.  Either the numerical or sym‐\nbolical value may be used.\n",
                        "flag": "-u",
                        "long": "--euid"
                    },
                    {
                        "name": "-U --uid _",
                        "content": "Only match processes whose real user ID is listed.  Either the numerical or symbolical\nvalue may be used.\n",
                        "flag": "-U",
                        "long": "--uid"
                    },
                    {
                        "name": "-v --inverse",
                        "content": "Negates the matching.  This option is usually used in pgrep's  or  pidwait's  context.\nIn  pkill's  context the short option is disabled to avoid accidental usage of the op‐\ntion.\n",
                        "flag": "-v",
                        "long": "--inverse"
                    },
                    {
                        "name": "-w --lightweight",
                        "content": "Shows all thread ids instead of pids in pgrep's or pidwait's context.  In pkill's con‐\ntext this option is disabled.\n",
                        "flag": "-w",
                        "long": "--lightweight"
                    },
                    {
                        "name": "-x --exact",
                        "content": "Only match processes whose names (or command lines if -f is specified)  exactly  match\nthe pattern.\n",
                        "flag": "-x",
                        "long": "--exact"
                    },
                    {
                        "name": "-F --pidfile _",
                        "content": "Read PIDs from file.  This option is more useful for pkill or pidwait than pgrep.\n",
                        "flag": "-F",
                        "long": "--pidfile"
                    },
                    {
                        "name": "-L --logpidfile",
                        "content": "Fail if pidfile (see -F) not locked.\n",
                        "flag": "-L",
                        "long": "--logpidfile"
                    },
                    {
                        "name": "-r --runstates _",
                        "content": "Match only processes which match the process state.\n",
                        "flag": "-r",
                        "long": "--runstates"
                    },
                    {
                        "name": "-A --ignore-ancestors",
                        "content": "Ignore  all  ancestors  of  pgrep, pkill, or pidwait.  For example, this can be useful\nwhen elevating with sudo or similar tools.\n",
                        "flag": "-A",
                        "long": "--ignore-ancestors"
                    },
                    {
                        "name": "-H --require-handler",
                        "content": "Only match processes with a userspace signal handler present  for  the  signal  to  be\nsent.\n\n--cgroup name,...\nMatch on provided control group (cgroup) v2 name. See cgroups(8)\n\n--ns pid\nMatch  processes  that belong to the same namespaces. Required to run as root to match\nprocesses from other users. See --nslist for how to limit which namespaces to match.\n\n--nslist name,...\nMatch only the provided namespaces. Available namespaces: ipc, mnt,  net,  pid,  user,\nuts.\n",
                        "flag": "-H",
                        "long": "--require-handler"
                    },
                    {
                        "name": "-q --queue _",
                        "content": "Use sigqueue(3) rather than kill(2) and the value argument is used to specify an inte‐\nger  to  be sent with the signal. If the receiving process has installed a handler for\nthis signal using the SASIGINFO flag to sigaction(2), then it can  obtain  this  data\nvia the sivalue field of the siginfot structure.\n",
                        "flag": "-q",
                        "long": "--queue"
                    },
                    {
                        "name": "-V --version",
                        "content": "Display version information and exit.\n",
                        "flag": "-V",
                        "long": "--version"
                    },
                    {
                        "name": "-h --help",
                        "content": "Display help and exit.\n",
                        "flag": "-h",
                        "long": "--help"
                    }
                ]
            },
            "OPERANDS": {
                "content": "pattern\nSpecifies  an  Extended  Regular  Expression for matching against the process names or\ncommand lines.\n",
                "subsections": []
            },
            "EXAMPLES": {
                "content": "Example 1: Find the process ID of the named daemon:\n\n$ pgrep -u root named\n\nExample 2: Make syslog reread its configuration file:\n\n$ pkill -HUP syslogd\n\nExample 3: Give detailed information on all xterm processes:\n\n$ ps -fp $(pgrep -d, -x xterm)\n\nExample 4: Make all chrome processes run nicer:\n\n$ renice +4 $(pgrep chrome)\n",
                "subsections": []
            },
            "EXIT STATUS": {
                "content": "0      One or more processes matched the  criteria.  For  pkill  and  pidwait,  one  or  more\nprocesses must also have been successfully signalled or waited for.\n1      No processes matched or none of them could be signalled.\n2      Syntax error in the command line.\n3      Fatal error: out of memory etc.\n",
                "subsections": []
            },
            "NOTES": {
                "content": "The  process  name used for matching is limited to the 15 characters present in the output of\n/proc/pid/stat.  Use the -f option to match against the complete command line, /proc/pid/cmd‐\nline. Threads may not have the same process name as the parent process but will have the same\ncommand line.\n\nThe running pgrep, pkill, or pidwait process will never report itself as a match.\n\nThe -O --older option will silently fail if /proc is mounted with the subset=pid option.\n",
                "subsections": []
            },
            "BUGS": {
                "content": "The options -n and -o and -v can not be combined.  Let me know if you need to do this.\n\nDefunct processes are reported.\n\npidwait requires the pidfdopen(2) system call which first appeared in Linux 5.3.\n",
                "subsections": []
            },
            "SEE ALSO": {
                "content": "ps(1), regex(7), signal(7), sigqueue(3), killall(1), skill(1), kill(1), kill(2), cgroups(8).\n",
                "subsections": []
            },
            "AUTHOR": {
                "content": "\u001b]8;;kjetilho@ifi.uio.no\u001b\\Kjetil Torgrim Homme\u001b]8;;\u001b\\\n",
                "subsections": []
            },
            "REPORTING BUGS": {
                "content": "Please send bug reports to \u001b]8;;procps@freelists.org\u001b\\procps@freelists.org\u001b]8;;\u001b\\\n\nprocps-ng                                    2023-01-16                                     PGREP(1)",
                "subsections": []
            }
        }
    }
}