![]() |
|
|
|
|
|||||||
| 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 !! |
|
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| How to print parent process name | mahendramahendr | Shell Programming and Scripting | 3 | 05-23-2008 04:59 AM |
| Who is the parent of a killed process ? | Puntino | UNIX for Dummies Questions & Answers | 6 | 05-13-2008 01:50 AM |
| Can a child process return a specific value to a parent process ? | Ametis1970 | High Level Programming | 8 | 04-09-2008 08:22 PM |
| how to find the chid process id from given parent process id | guhas | Shell Programming and Scripting | 3 | 10-13-2005 05:13 AM |
| what the getppid of parent process print | ramneek | IP Networking | 1 | 08-24-2005 06:52 AM |
|
|
Submit Tools | LinkBack | Thread Tools | Display Modes |
| Forum Sponsor | ||
|
|
|
|||
|
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
|
| Thread Tools | |
| Display Modes | |
|
|
|
The 50 most popular UNIX and Linux searches.
Google Search Cloud for The UNIX and Linux Forums
|
| 421 service not available, remote server has closed connection ^m autosys awk trim bash eval bash exec bash for loop command copy/move folder in unix couldn't set locale correctly curses.h cut command in unix daemon process export command in unix find grep find mtime find null character in a unix file grep multiple lines grep or grep recursive hp-ux ifconfig inaddr_any inappropriate ioctl for device lynx javascript mailx attachment mget mtime ping port remove first character from string in k shell replace space by comma , perl script scp recursive segmentation fault(coredump) sftp script snoop unix stale nfs file handle syn_sent tar exclude tar extract to folder test: argument expected unix unix .profile unix forum unix forums unix internals unix interview questions unix simulator unix.com vi select all vi substitute vi+substitute+end+of+line+character while loop within while loop shell script |