![]() |
Hello and Welcome from United States to the UNIX and Linux Forums! Thank You for Visiting and Joining Our Global Community.
|
|
google unix.com
|
|||||||
| Forums | Register | Forum Rules | Links | Albums | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
| UNIX for Dummies Questions & Answers If you're not sure where to post a UNIX or Linux question, post it here. All UNIX and Linux newbies welcome !! |
More UNIX and Linux Forum Topics You Might Find Helpful
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| How to print parent process name | mahendramahendr | Shell Programming and Scripting | 3 | 05-23-2008 07:59 AM |
| Who is the parent of a killed process ? | Puntino | UNIX for Dummies Questions & Answers | 6 | 05-13-2008 04:50 AM |
| Can a child process return a specific value to a parent process ? | Ametis1970 | High Level Programming | 8 | 04-09-2008 11:22 PM |
| how to find the chid process id from given parent process id | guhas | Shell Programming and Scripting | 3 | 10-13-2005 08:13 AM |
| what the getppid of parent process print | ramneek | IP Networking | 1 | 08-24-2005 09:52 AM |
![]() |
|
|
LinkBack | Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
||||
|
On the most unix flavours the -f(ull) option will show the PPID
like /logs: ps -f UID PID PPID C STIME TTY TIME CMD net400 24032 24268 2 17:02:15 pts/0 0:00 ps -f net400 24268 13026 0 16:37:04 pts/0 0:00 -csh /logs: |
|
||||
|
|
|
|||||
|
No. thats a lot of info. but doesnt give me an answer.
I am looking for an alternative to this: for PID in `ps -ef |grep -v root| grep " 1 " | awk '{print $2}'` The grep " 1" is giving me all processes running under PPID = 1. I could also awk'{print $3}' and evaluate it for a value of 1 I found in the man pages a switch -p to identify proccesses for a PID. I am wondering if maybe there is a switch for PPID that I'm missing when I look up the use of ps. |
|
|||||
|
For a list of pid's that are not owned by root but have a ppid of 1, I would go with:
Code:
#! /usr/bin/ksh
ps -ef | sed 1d | while read user pid ppid junk ; do
if [[ $user != root && $ppid = 1 ]] ; then
echo $pid
fi
done
exit 0
|
![]() |
| Bookmarks |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|