Process Information by PID

Thomas Guettler guettli at thomas-guettler.de
Thu Oct 16 09:23:23 EDT 2003


Am Thu, 16 Oct 2003 08:56:18 -0400 schrieb Peter Hansen:

> Thomas Guettler wrote:
>> 
>> I want to get some information about
>> a process.
>> 
>> I know its PID, and I need
>> to know the commandline.
>> 
>> I need something like:
>> > ps -p $THISPID
> 
> Surely you've already considered using popen?  On the other hand,
> using "-p" doesn't give me the command line for processes, just 
> the name of the command itself.

You are right. In my case the name of the command would be enough.

popen: I read the PID from a file, the background process
gets started before my script.
 
> What about reading from the /proc/$PID/cmdline pseudo-file ?

Is this portable to other unix systems?

 thomas




More information about the Python-list mailing list