Here's a script that sends a SIGKILL (9) signal to all the processes with process ids provided as arguments, and to all their child processes, going from child processes up to their parents:
for cpid in $(ps -o pid= --ppid $1)
echo "killing: $(ps -p $1 -o cmd=)"
kill -9 $1 > /dev/null 2>&1
if [[ $# == 0 ]]; then
echo "usage: $(basename $0) <top pid to kill>"
for pid in $*
(credits: this is based on a script that I found at the comp.unix.shell newsgroup archive)