watch runs a command and keeps its output on screen updating it ever X seconds and, optionally, highlighting the differences on the output between executions. It’s an easy way to monitor the output of some command without having to spend several minutes pressing “cursor up - enter”. :-)
watch -n 1 "ps aux | grep apache"
Si te ha interesado, ¿me invitas a una cerveza? / If you liked the post, would you buy me a beer?
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:
kill $SIGNAL $(ps aux | grep $PROG | awk '{print $2}')
Si te ha interesado, ¿me invitas a una cerveza? / If you liked the post, would you buy me a beer?
Últimos comentarios
RSS