
As mentioned, in other posts, "killall" or "pkill" do the trick. Additionally, awk is pretty handy for regex (and logic) matching on its own. Piping grep into awk is one of my pet peaves (of which I have 69105).
This might be cleaner (but still kills things with emacs as an argument):
# kill -9 `ps -ef | awk '/emacs/{print $2;}'`
This might be a bit more specific...
# kill -9 `ps -eopid,comm | awk '/emacs/{print $1;}'`
Alot of my old-school friends decry the use of xargs, but I'd rather pipe than arg-mangle (plus this gets rid of those visually deceptive singlequote+backquote):
# ps -eopid,comm | awk '/emacs/{print $1;}' | xargs kill -9
If you simply want to confound and taunt emacs users...
# pkill -STOP emacs
Or unending terror.
# { crontab -l ; echo '* * * * * pkill -STOP emacs' ; } | crontab
Sorry - couldn't help myself - if you're going to identify yourself as someone's better,
s/bald/hairless/; s/hairless/bold/;
"Joy is wealth and love is the legal tender of the soul." -- Robert G. Ingersoll