LinuxQuestions.org
Help answer threads with 0 replies.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Enterprise Linux Forums > Linux - Enterprise
User Name
Password
Linux - Enterprise This forum is for all items relating to using Linux in the Enterprise.

Notices


Reply
  Search this Thread
Old 10-26-2007, 08:56 AM   #1
sanjaykhuntia
LQ Newbie
 
Registered: Oct 2007
Posts: 14

Rep: Reputation: 0
PPID from /proc file system?


hi,
can anyone please tell me if i can get parent process id form /proc file system in RHEL 4? i know i can get the process id thru a small program from /proc, but i am doubtful about where the ppid is stored?

can anyone give me any idea where i can get ppid in /proc and how to read that value?
a small code will also do fine if one can provide.

Thanks in advance for ur reply,
sanjay
 
Old 10-26-2007, 03:40 PM   #2
MensaWater
LQ Guru
 
Registered: May 2005
Location: Atlanta Georgia USA
Distribution: Redhat (RHEL), CentOS, Fedora, CoreOS, Debian, FreeBSD, HP-UX, Solaris, SCO
Posts: 7,831
Blog Entries: 15

Rep: Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669
cat /proc/<number>/stat

e.g. for PID #14:

cat /proc/14/stat
14 (kblockd/0) S 11 1 1 0 -1 41024 0 0 0 0 0 2336 0 0 10 -5 1 0 258 0 0 4294967295 0 0 0 0 0 0 2147483647 65536 0 0 0 0 17 0 0 0

The 11 in the above (4th field) is the PPID.

To get detailed infromation about what can be found /proc type:
man proc

This gives you the man(ual) page for the proc command which is very detailed. In there if you do search for "ppid" you'll see the explanation that would have led you to the above information.
 
  


Reply

Tags
from, proc



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
How to get these information using proc file system. cppkid Programming 1 10-02-2005 07:55 PM
Is proc file system standardized across distro alred Programming 6 03-27-2005 03:19 PM
use of proc file system in linux device driver amitchakote Linux - Software 0 06-20-2004 11:27 AM
pidof -o %PPID program vanalex Linux - General 2 01-26-2004 09:35 PM
What /proc proc file do I need? GoboFraggle Programming 1 02-04-2003 11:52 PM

LinuxQuestions.org > Forums > Enterprise Linux Forums > Linux - Enterprise

All times are GMT -5. The time now is 02:35 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration