How to find a program’s process id (pid)

Here’s an easy way to get the pid of a running process.

Running the “pidof” command will return the pid(s) for a running program. See sample below,

danny@pandora:~> pidof syslog-ng
2043
danny@pandora:~> pidof acpid
2045
danny@pandora:~> pidof /usr/bin/firefox
14408
danny@pandora:~> pidof /usr/bin/compiz
27164
danny@pandora:~> pidof /bin/bash
27011 17339 16792 16477 15151 14403

Simple right!?

3 Responses to “How to find a program’s process id (pid)”

Author comments are in a darker gray color for you to easily identify the posts author in the comments

  1. zaheer arif says:

    Dear,
    I have a question.Suppose we have two pogramms.The control of child program is in the parent one.I just one to kill the process of child program after a few min or seconds while the Parent programm is running in Linux.Help in this regard would be really appreciated.

  2. Danesh says:

    do a ps -ef | grep “the process name”

    then kill that PID

  3. zaheer arif says:

    Dear,
    In connection with the above problem ,I don’t know the process name of the child program.Thanks in advance.

Leave a Reply

© 2008-2009 The Danesh Project
Powered by Wordpress and made by Guerrilla. Best viewed in Mozilla Firefox