Given a PPID, how to find all the associated PIDs?

advertisements

It might be a weird question as I searched and found many people asking about how to find the PPID given a PID. However, I'm interested in finding out all the PID of a given PPID.

The incentive was to run a process check using pidstat and from my test with pidstat, it seems to be that pidstat only reports meaningful child process stats and if I have a driver script and I want to access each individual processes within the driver script, I need to htop and find out the PIDs individually. When I invoked a driver script, such as bash script.sh, there is a ID associated with this command and this ID becames the PPID of all the processes within the driver scripts (if I understand it correctly).

So does anyone know how to get all the PIDs of a PPID?

Thanks!


Try doing this :

$ ps --ppid <YOUR PPID> -o pid=