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

1 Answer 1


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

My answer to this question may help: https://stackoverflow.com/questions/30980234/linux-the-most-reliable-way-to-terminate-a-family-of-processes/31004557?noredirect=1#comment50067451_31004557.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.