I’m almost ashamed to admit I didn’t knew of this command until very recently. :-)
Everybody knows the kill command, and almost everybody knows killall too (like kill using the process’ name instead of its PID). The problem with killall is that it only signals the processes matching the exact name you specify, and sometimes you want to work over a series of related processes that begin with the same word, or have a given word on their command line. pkill does just that:
pkill -9 -f foo
As a side note, what I used before when I wanted to do this was:
Si te ha interesado, ¿me invitas a una cerveza? / If you liked the post, would you buy me a beer?kill $SIGNAL $(ps aux | grep $PROG | awk '{print $2}')

Últimos comentarios
RSS