[PLUG] Finding application parent PID?

Rogan Creswick creswick at cs.orst.edu
Sun Jan 25 20:43:01 UTC 2004


I don't understand your question, but here are the answers to
questions you might be asking:

On Sun, Jan 25, 2004 at 07:01:16PM -0800, Alex Daniloff wrote:
> Hello Linux folkz,
> Assuming that I don't know the location of an application .pid file.

Are you referring to a file that acts like a lock of sorts, and
prevents the application from starting again?

These files don't have a standard location, or anything that defines
or requires their existence.  ~/.<programName>/ is a good place to
look, or search for <programName>.pid.  /var and /etc are also common
places for these files.

> How can I find or identify the application pid without using 
> 'ps -ef|grep application' or scanning all /proc/pid_number/cmdline 
> files?

If you just want the pid of a program, "pidof" works well.

$ pidof bash
5795 5794 7372

although you can't see which pid corresponds to which instance of the
program (obviously not an issue if there is only one instance
running).

If you are interested in the parents of a program, the f option
(--forest) to ps is fun.

$ ps -ef f

<snip>
root       599     1  0 Jan17 ?        S      0:00 /usr/bin/gdm
root     17742   599  0 Jan20 ?        S      0:00  \_ /usr/bin/gdm
root     17743 17742  6 Jan20 ?        S<   500:37      \_ /usr/X11R6/bin/X :0 -
rogue    17751 17742  0 Jan20 ?        S     47:55      \_ /usr/bin/enlightenmen
rogue    17799 17751  0 Jan20 ?        S      0:01          \_ /usr/bin/ssh-agen
rogue    17800 17751  0 Jan20 ?        S      0:11          \_ xscreensaver -nos
rogue    17804 17751  0 Jan20 ?        S      0:00          \_ licq
rogue    17805 17804  0 Jan20 ?        S      0:05          |   \_ licq
rogue    17806 17805  0 Jan20 ?        S      0:07          |       \_ licq
<snip>


Hopefully that helps someone.  If I didn't address your question, can
you clarify it?

-Rogan




More information about the PLUG mailing list