Is there any command, or any simpler way to get the full list of all descendant processes?

8 Answers

ActiveOldestVotes20

The following is somewhat simpler, and has the added advantage of ignoring numbers in the command names:

                                                                              pstree -p $pid | grep -o '([0-9]\+)' | grep -o '[0-9]\+'

Or with Perl:

                                                                              pstree -p $pid | perl -ne 'print "$1\n" while /\((\d+)\)/g'

We’re looking for numbers within parentheses so that we don’t, for example, give 2 as a child process when we run across gif2png(3012). But if the command name contains a parenthesized number, all bets are off. There’s only so far text processing can take you.

So I also think that process groups are the way to go. If you’d like to have a process run in its own process group, you can use the ‘pgrphack’ tool from the Debian package ‘daemontools’:

                                                                              pgrphack my_command args

Or you could again turn to Perl:

                                                                              perl -e 'setpgid or die; exec { $ARGV[0] } @ARGV;' my_command args

The only caveat here is that process groups do not nest, so if some process is creating its own process groups, its subprocesses will no longer be in the group that you created.ShareImprove this answerFollowanswered Jul 14 ’13 at 19:01Jander14.7k55 gold badges4343 silver badges6565 bronze badges

Here is a link to the RX Audio Cookbook for spectral audio correction:

https://rxcookbook.izotope.com/

Here’s a copy on the home page as well.

Welcome to the iZotope RX Audio Cookbook

The iZotope RX Audio Cookbook is designed to help you find solutions or ‘recipes’ for solving common audio problems. Each recipe includes step-by-step directions, before and after audio examples, illustrations and tips for solving stubborn problems.

As you work through the Cookbook, be sure to send us your feedback.