Kill a process using name

This a small post about a linux command make my life easier, when i want to kill a process i was using to get PID then use kill with this process PID, this was require that i do the next long line:

kill < `ps aux | grep process_to_kill | awk ‘{print $2}’ | head -n 1`

Recently, i found the equivalent of this painfull line 🙂 :

pkill process_to_kill

But without the first line i used to use i wouldn’t get familiar with ps, awk, head, tail. But now for sure i will use pkill :).

5 thoughts on “Kill a process using name

Leave a comment