I would like to get a list of all the processes that descend (e.g. children, grand-children, etc) from $pid. This is the simplest way I've come up with:
pstree -p $pid | tr "\n" " " |sed "s/[^0-9]/ /g" |sed "s/\s\s*/ /g"
Is there any command, or any simpler way to get the full list of all descendant processes?
Thanks!
'\n'delimited vs.' 'delimited). Practical use case is: a) a daemonizer script I wrote out of pure masochism (specifically, the "stop" functionality has to deal with whatever tree of processes the daemonized process spawned); and b) a timeout script that will kill whatever the timed-out process managed to create. – STenyaK Mar 12 at 21:06kill. See unix.stackexchange.com/questions/9480/…, unix.stackexchange.com/questions/50555/… – Gilles Mar 12 at 21:51ps ax -opid,ppid,pgrp,cmdI see there are many processes that share the samepgrpas the exact subtree I want to kill. (Additionally, I can't see thesetpgrpprogram listed anywhere in debian stable packages: packages.debian.org/… ) – STenyaK Mar 13 at 7:42