Linux – Kill process and child processes, not parent processes, not group


I need to kill a process and all of its subprocesses programatically.

Killing the group is not an option because I do not want to kill the parent processes.


pid        process
    1      nice parent process that should live
    2      subprocess of 1, but a nice one, should live
    3      subprocess of 1, evil one, should die
    4      childprocess of 3, inherite evil, should die
    5      childprocess of 3, inherite evil, should die
    6      childprocess of 5, inherite evil second line, should die

kill --some-cool-option 3

Best Answer

I don't think there is a solution as simple as a simple kill command.

My answer to this question may help:

Related Topic