1PIDOF(8) Linux System Administrator's Manual PIDOF(8)
2
3
4
6 pidof -- find the process ID of a running program.
7
9 pidof [-s] [-c] [-x] [-m] [-o omitpid] [-o omitpid..] program [pro‐
10 gram..]
11
13 Pidof finds the process id's (pids) of the named programs. It prints
14 those id's on the standard output. This program is on some systems used
15 in run-level change scripts, especially when the system has a System-V
16 like rc structure. In that case these scripts are located in
17 /etc/rc?.d, where ? is the runlevel. If the system has a start-stop-
18 daemon (8) program that should be used instead.
19
21 -s Single shot - this instructs the program to only return one pid.
22
23 -c Only return process ids that are running with the same root
24 directory. This option is ignored for non-root users, as they
25 will be unable to check the current root directory of processes
26 they do not own.
27
28 -x Scripts too - this causes the program to also return process
29 id's of shells running the named scripts.
30
31 -o omitpid
32 Tells pidof to omit processes with that process id. The special
33 pid %PPID can be used to name the parent process of the pidof
34 program, in other words the calling shell or shell script.
35
36 -m When used with -o, will also omit any processes that have the
37 same argv[0] and argv[1] as any explicitly omitted process ids.
38 This can be used to avoid multiple shell scripts concurrently
39 calling pidof returning each other's pids.
40
42 0 At least one program was found with the requested name.
43
44 1 No program was found with the requested name.
45
47 pidof is actually the same program as killall5; the program behaves
48 according to the name under which it is called.
49
50 When pidof is invoked with a full pathname to the program it should
51 find the pid of, it is reasonably safe. Otherwise it is possible that
52 it returns pids of running programs that happen to have the same name
53 as the program you're after but are actually other programs. Note that
54 that the executable name of running processes is calculated with read‐
55 link(2), so symbolic links to executables will also match.
56
57
59 shutdown(8), init(8), halt(8), reboot(8), killall5(8)
60
62 Miquel van Smoorenburg, miquels@cistron.nl
63
64
65
66 01 Sep 1998 PIDOF(8)