pid from process name

Tom Christiansen tchrist at convex.UUCP
Sun Jul 16 00:06:24 AEST 1989


In article <11723 at drutx.ATT.COM> blum at drutx.ATT.COM (Mark Blumhardt) writes:
>Given a process name, how can I find its process id?   It just isn't
>obvious to me, other than a system call to grep thru the output of ps,
>which I don't want to do.

What is a "process name"?  You mean u.u_comm (basically *argv)?  That's 
hardy unique.  If you have control over the process you're interested in 
have it write its pid somewhere.  Otherwise you're going to have to 
do the 'ps|grep' thing unless you're up to a kernel dive, in which of 
course all things are possible but not all are expedient. :-)

--tom



More information about the Comp.unix.wizards mailing list