How to kill all process with given name?

pkill -f 'PATTERN'

Will kill all the processes that the pattern PATTERN matches. With the -f option, the whole command line (i.e. including arguments) will be taken into account. Without the -f option, only the command name will be taken into account.

See also man pkill on your system.


The problem is that ps -A | grep <application_name> | xargs -n1 returns output like this

19440
?
00:00:11
<application_name>
21630
?
00:00:00
<application_name>
22694
?
00:00:00
<application_name>

You can use awk to a get first a column of ps output.

ps -A | grep <application_name> | awk '{print $1}' | xargs -n1

Will return list of PIDs

19440
21630
22694

And adding kill -9 $1 you have a command which kills all PIDs

ps -A | grep <application_name> | awk '{print $1}' | xargs kill -9 $1