This is a oneliner to kill all instances of a program using ps, grep and awk.

Want to get rid of all cudp processes.

$ kill $(ps ax | grep cudp | awk '{print $1}')