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?

link|improve this question
Please be more specific and provide the example or the actual terminal scrrenshot. – D.J. Jun 29 '10 at 9:51
feedback

migrated from stackoverflow.com Jun 29 '10 at 9:58

This question came from our site for professional and enthusiast programmers.

3 Answers

killall bla

to force it:

killall -9 bla
link|improve this answer
feedback

Take a look at pkill, if available.

link|improve this answer
1  
+1. man pkill also mentions the pgrep. The tools are part of the same package as top and ps and should be available on pretty much all Linux systems. (Solaris has them too). killall and pidof are not so portable. – Dummy00001 Jun 29 '10 at 10:47
pkill is the most flexible by far. Kills by user, parent process, terminal… – Tobu Jun 29 '10 at 10:57
feedback

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>

link|improve this answer
Do you shut down your computer by holding the power button for X amount of seconds also? Because kill -9 is equally stupid. Please read speculation.org/garrick/kill-9.html – Anders Jun 29 '10 at 9:51
this way you are killing the process by his pid but by this name. – Hippo Jun 29 '10 at 9:55
feedback

Your Answer

 
or
required, but never shown