{
    "mode": "man",
    "parameter": "pidof",
    "section": "8",
    "url": "https://www.chedong.com/phpMan.php/man/pidof/8/json",
    "generated": "2026-10-04T15:36:04Z",
    "synopsis": "pidof  [-s]  [-c] [-n] [-x] [-z] [-o omitpid[,omitpid...]]  [-o omitpid[,omitpid...]...]  [-d\nsep] program [program...]",
    "sections": {
        "NAME": {
            "content": "pidof - find the process ID of a running program\n",
            "subsections": []
        },
        "SYNOPSIS": {
            "content": "pidof  [-s]  [-c] [-n] [-x] [-z] [-o omitpid[,omitpid...]]  [-o omitpid[,omitpid...]...]  [-d\nsep] program [program...]\n",
            "subsections": []
        },
        "DESCRIPTION": {
            "content": "pidof finds the process id's (PIDs) of the named programs. It prints those id's on the  stan‐\ndard  output.  This  program  is on some systems used in run-level change scripts, especially\nwhen the system has a System-V like rc structure. In that case these scripts are  located  in\n/etc/rc?.d,  where  ?  is the runlevel. If the system has a start-stop-daemon(8) program that\nshould be used instead.\n",
            "subsections": []
        },
        "OPTIONS": {
            "content": "",
            "subsections": [
                {
                    "name": "-s",
                    "content": "",
                    "flag": "-s"
                },
                {
                    "name": "-c",
                    "content": "is ignored for non-root users, as they will be unable to check the current root direc‐\ntory of processes they do not own.\n",
                    "flag": "-c"
                },
                {
                    "name": "-n",
                    "content": "file systems like NFS.  Instead of using this option the variable PIDOFNETFS  may  be\nset and exported.\n",
                    "flag": "-n"
                },
                {
                    "name": "-q",
                    "content": "false to indicate whether a matching PID was found.\n",
                    "flag": "-q"
                },
                {
                    "name": "-x",
                    "content": "the named scripts.\n",
                    "flag": "-x"
                },
                {
                    "name": "-z",
                    "content": "are skipped as trying to deal with them can cause pidof  or  related  tools  to  hang.\nNote:  In  the past pidof would ignore processes in the uninterruptable state (D), un‐\nless the -z flag was specified. This is no longer the case.  The  pidof  program  will\nfind and report processes in the D state whether -z is specified or not.\n\n-d sep Tells  pidof  to use sep as an output separator if more than one PID is shown. The de‐\nfault separator is a space.\n\n-o omitpid\nTells pidof to omit processes with that process id. The special pid %PPID can be  used\nto  name  the parent process of the pidof program, in other words the calling shell or\nshell script.\n",
                    "flag": "-z"
                }
            ]
        },
        "EXIT STATUS": {
            "content": "0      At least one program was found with the requested name.\n\n1      No program was found with the requested name.\n",
            "subsections": []
        },
        "NOTES": {
            "content": "pidof is actually the same program as killall5(8); the program behaves according to the  name\nunder which it is called.\n\nWhen  pidof  is  invoked with a full pathname to the program it should find the pid of, it is\nreasonably safe. Otherwise it is possible that it returns PIDs of running programs that  hap‐\npen  to  have the same name as the program you're after but are actually other programs. Note\nthat the executable name of running processes is calculated  with  readlink(2),  so  symbolic\nlinks to executables will also match.\n\nZombie  processes  or  processes in disk sleep (states Z and D, respectively) are ignored, as\nattempts to access the stats of these will sometimes fail.  The -z  flag  (see  above)  tells\npidof  to  try to detect these sleeping and zombie processes, at the risk of failing or hang‐\ning.\n\n",
            "subsections": []
        },
        "SEE ALSO": {
            "content": "shutdown(8), init(8), halt(8), reboot(8), killall5(8)\n",
            "subsections": []
        },
        "AUTHOR": {
            "content": "Miquel van Smoorenburg\n\nsysvinit                                     01 Sep 1998                                    PIDOF(8)",
            "subsections": []
        }
    },
    "summary": "pidof - find the process ID of a running program",
    "flags": [
        {
            "flag": "-s",
            "long": null,
            "arg": null,
            "description": ""
        },
        {
            "flag": "-c",
            "long": null,
            "arg": null,
            "description": "is ignored for non-root users, as they will be unable to check the current root direc‐ tory of processes they do not own."
        },
        {
            "flag": "-n",
            "long": null,
            "arg": null,
            "description": "file systems like NFS. Instead of using this option the variable PIDOFNETFS may be set and exported."
        },
        {
            "flag": "-q",
            "long": null,
            "arg": null,
            "description": "false to indicate whether a matching PID was found."
        },
        {
            "flag": "-x",
            "long": null,
            "arg": null,
            "description": "the named scripts."
        },
        {
            "flag": "-z",
            "long": null,
            "arg": null,
            "description": "are skipped as trying to deal with them can cause pidof or related tools to hang. Note: In the past pidof would ignore processes in the uninterruptable state (D), un‐ less the -z flag was specified. This is no longer the case. The pidof program will find and report processes in the D state whether -z is specified or not. -d sep Tells pidof to use sep as an output separator if more than one PID is shown. The de‐ fault separator is a space. -o omitpid Tells pidof to omit processes with that process id. The special pid %PPID can be used to name the parent process of the pidof program, in other words the calling shell or shell script."
        }
    ],
    "examples": [],
    "see_also": [
        {
            "name": "shutdown",
            "section": "8",
            "url": "https://www.chedong.com/phpMan.php/man/shutdown/8/json"
        },
        {
            "name": "init",
            "section": "8",
            "url": "https://www.chedong.com/phpMan.php/man/init/8/json"
        },
        {
            "name": "halt",
            "section": "8",
            "url": "https://www.chedong.com/phpMan.php/man/halt/8/json"
        },
        {
            "name": "reboot",
            "section": "8",
            "url": "https://www.chedong.com/phpMan.php/man/reboot/8/json"
        },
        {
            "name": "killall5",
            "section": "8",
            "url": "https://www.chedong.com/phpMan.php/man/killall5/8/json"
        }
    ]
}