Latest LQ Deal: Linux Power User Bundle
Go Back > Forums > Enterprise Linux Forums > Linux - Enterprise
User Name
Linux - Enterprise This forum is for all items relating to using Linux in the Enterprise.


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

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

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,
Old 10-26-2007, 03:40 PM   #2
LQ Guru
Registered: May 2005
Location: Atlanta Georgia USA
Distribution: Redhat (RHEL), CentOS, Fedora, CoreOS, Debian, FreeBSD, HP-UX, Solaris, SCO
Posts: 6,953
Blog Entries: 14

Rep: Reputation: 1166Reputation: 1166Reputation: 1166Reputation: 1166Reputation: 1166Reputation: 1166Reputation: 1166Reputation: 1166Reputation: 1166
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.


from, proc

Thread Tools Search this Thread
Search this Thread:

Advanced Search

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 > Forums > Enterprise Linux Forums > Linux - Enterprise

All times are GMT -5. The time now is 02:50 PM.

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