Based on man ps there are four parameters that relate to groups:
-G grplist Select by real group ID (RGID) or name. This selects the processes whose real group name or ID is in the grplist list. The real group ID identifies the group of the user who created the process, see getgid(2). -g grplist Select by session OR by effective group name. Selection by session is specified by many standards, but selection by effective group is the logical behavior that several other operating systems use. This ps will select by session when the list is completely numeric (as sessionsare). Group ID numbers will work only when some group names are also specified. See the -s and
So you can get the group id for your program using getpgrp [pid-of-your-program] , then call ps -G [group-if-of-your-program] .
Perhaps this is not the way you want. The process groups and the processes that make up the tree seem different. ppid is the parent pid of the process, you may need something that tells you all the pids with a given pid, like their ppid? I do not think there is anything to guarantee that it is the same that all pids are in the same process group, in fact, if there is only one process group for each process, they cannot be.
As suggested above, pstree should help you understand what is happening. The --show-pids option will also give you all the useful data that may be useful.
source share