You can loop through the process list, identifying children
with the same parent and kill them one by one.
Attribution: http://www.unix.com/17901-post4.html
#!/bin/sh
while true
do
echo "Enter parent process id [type quit for exit]"
read ppid
if [ $ppid -eq "quit" -o $ppid -eq "QUIT" ];then
exit 0
fi
for i in `ps -ef| awk '$3 == '$ppid' { print $2 }'`
do
echo killing $i
kill $i
done
done
You can also kill by session id but that get's the parent and the
children.
https://serverfault.com/questions/40303/how-do-you-kill-a-process-tree-in-linux
ps -eo pid,ppid,sess,cmd -u ppetraki | grep whoami
pkill -9 -s SESS_ID
Using the information from the later, you could build a simpler
tool that targeted only children.