PID

From Linux Shell Scripting Tutorial - A Beginner's handbook
Jump to navigation Jump to search

The PID (process ID) is an acronym for Process identifier. It is nothing but a number used by Linux / Unix kernels to identify a process on the system. Usually, new processes are created using the fork() system call.

How do I find the process ID of a running program?

You need to use the pidof command as follows to find pid of httpd program:

pidof progra-name
pidof httpd
pidof sshd
pidof firefox-bin

Sample outputs:

2582

You can type the following command to verify that the PID 2582 belongs to firefox:

ls -l /proc/2582/exe

Sample outputs:

lrwxrwxrwx 1 vivek vivek 0 2010-12-21 22:24 /proc/2582/exe -> /usr/lib/firefox-3.6.13/firefox-bin

See also