How to find all the child processes of a parent process

Hi
I am trying to see if there are some options in ps command or if there is a shell script which basically shows you all the processes spawned by a parent process , then all the processes of its child processes and so on down the hierarchy may be like a tree structure. It might be a generic issue in other environments .

Regards
Clifford

The ptree command does that, but not all UNIX systems support it. When you ask a question it is a good idea to mention the UNIX name and version so we don't give you possibly bad answers, like ptree could be.

If you are on linux -
open the man page for ps with

man ps

then do a forward find on the word tree with /tree

I apologize for replying so late and not mentioning the OS. It is AIX 5.2.0.0.
here there is no ptree. I could not find any direct method with ps.

Regards

What you need is pstree. It's available in many forms. Check these out:

Minimal Homepage of pstree

AIX 5L Open Source Packages | Main / pstree

Helpful Administrative Scripts

On Solaris you would do something like ptree <PID>.

After re-reading what you want, This is how I would achieve that in Solaris,
ps -elf|grep -v UID |awk '{print "ptree " $4}'|sh

Thanks, this looks promising . AIX does not have ptree or pstree . The one by welters is easy to use.