Kill process by command name

I would like to kill a java process based on the command name... Whats the best way to do it?

(i.e. when you do ps -f the name in the CMD column).


Simples, use pkill

pgrep, pkill - look up or signal processes based on name and other attributes


One way is with killall:

killall - kill processes by name

You can do it with killall NAME.

Also, you can use the option

-e,--exact          require exact match for very long names