Tutorial :How do I kill a process by its name in Linux?



Question:

I have a process with the name bla, and I want to kill it by its name.

When I run ps aux | grep "bla", I get 2 entries:

  • process bla and
  • blablablab

How do I filter it out?


Solution:1

killall bla  

to force it:

killall -9 bla  


Solution:2

Take a look at pkill, if available.


Solution:3

You can use the PID of the process to kill it.

Check out man pages for command kill.

The exact option would be kill -9 <pid>


Solution:4

While the killing question has been well answered, you asked how can you avoid getting the process "blabla" when you wanted "bla". What you want to do is add -w:

ps aux | grep -w "bla"  

Note:If u also have question or solution just comment us below or mail us on toontricks1994@gmail.com
Previous
Next Post »