How to kill a child process by the parent process?

Send a SIGTERM or a SIGKILL to it:

SIGTERM is polite and lets the process clean up before it goes, whereas, SIGKILL is for when it won’t listen >:)

Example from the shell (man page: )

kill -9 pid

In C, you can do the same thing using the kill syscall:

kill(pid, SIGKILL);

See the following man page:

Leave a Comment