Pidof
Encyclopedia
pidof is a Linux
Linux
Linux is a Unix-like computer operating system assembled under the model of free and open source software development and distribution. The defining component of any Linux system is the Linux kernel, an operating system kernel first released October 5, 1991 by Linus Torvalds...

 utility that returns the process identifier
Process identifier
In computing, the process identifier is a number used by most operating system kernels to uniquely identify a process...

 (PID) of a running process or processes. On other operating systems, pgrep
Pgrep
pgrep is a command-line utility initially written for use with the Solaris 7 operating system. It has since been reimplemented for Linux and the BSDs . It searches for all the named processes that can be specified as extended regular expression patterns, and—by default—returns their process ID...

and ps
Ps (Unix)
In most Unix-like operating systems, the ps program displays the currently-running processes. A related Unix utility named top provides a real-time view of the running processes....

are often used instead.

pidof is implemented in the same program as killall5 (see readlink $(command -v pidof)), the Linux name for the System V killall
Killall
killall is a command line utility available on Unix-like systems. There are two very different implementations.* The implementation supplied with genuine UNIX System V and with the Linux [ftp://ftp.cistron.nl/pub/people/miquels/sysvinit/ sysvinit] tools is a particularly dangerous command that...

program used by the runlevel
Runlevel
The term runlevel refers to a mode of operation in one of the computer operating systems that implement Unix System V-style initialization. Conventionally, seven runlevels exist, numbered from zero to six; though up to ten, from zero to nine, may be used. S is sometimes used as a synonym for one...

 scripts. pidof is usually a symbolic link
Symbolic link
In computing, a symbolic link is a special type of file that contains a reference to another file or directory in the form of an absolute or relative path and that affects pathname resolution. Symbolic links were already present by 1978 in mini-computer operating systems from DEC and Data...

to killall5, and the name the program is called under is what determines its behavior.

Some examples that return the process identifiers of several processes using pidof:


$ pidof ntpd
3580 3579

$ pidof emacs
22256

$ pidof file
10269
The source of this article is wikipedia, the free encyclopedia.  The text of this article is licensed under the GFDL.
 
x
OK