How hard can it be? ps child/parent

:frowning:
Since I'm fairly new to the scene and don't have much experience in shell programming, I decided to check out the net for a useful script or two.
What I'm looking for is a script that would let me enter a PID and then show the process tree associated with it.
So it would display the (grand-) parents up to top-level and all children for that process, preferably in a tree like manner.
This would come in quite handy if I have to kill a certain process, because it would help me identify related processes.
Is there a script that would do that or just simply display a tree starting at PID 0?
You'd think it would be easy to find, but apparently it's harder to create it than I thought, because after several hours of browsing, I haven't found anything that comes close.
Anyone here that can help me?

Sounds like you are looking for pstree (although it is not a shell script). BTW, freshmeat.net is usually the best place to search for open source software like this.

i believe pstree or ptree is only avaialble for Solaris 8 or higher

using awk
try using a script in the form

ps -ef | awk ' $2 /mycommand/'

jasmine (SCSA & MCSE)