603 ? Ss 0:01 /usr/sbin/cron 18421 ? S 0:00 \_ /usr/sbin/cron 18423 ? Ss 0:00 | \_ /bin/sh /opt/pdi-jobs/4.3.0/CST/CE_Upload/CE_Upload_MON.sh 18425 ? S 0:00 | \_ /bin/sh ./kitchen.sh -file=/opt/pdi-jobs/4.3.0/... 18444 ? Sl 1:47 | \_ java -Xmx512m -cp .:./lib/kettle-core.jar... #### use Proc::ProcessTable; my $processes = new Proc::ProcessTable; my @java_processes = grep { $_->cmndline =~ /^\/System/ } @{ $processes->table }; # fake pattern, got no java at home ;-) foreach my $java_process (@java_processes) { my $pid = $java_process->pid; # more stuff with this pid my $ppid = $java_process->ppid; my @parent = grep { $_->pid == $ppid } @{ $processes->table }; # more stuff with the parent my $gppid = $parent[0]->ppid; my @gparent = grep { $_->pid == $gppid } @{ $processes->table }; # more stuff with the grandparent my $ggppid = $gparent[0]->ppid; my @ggparent = grep { $_->pid == $ggppid } @{ $processes->table }; # more stuff with the great-grandparent }