Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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?

share|improve this question

migrated from Jun 29 '10 at 9:58

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

Please be more specific and provide the example or the actual terminal scrrenshot. – D.J. Jun 29 '10 at 9:51
killall bla

to force it:

killall -9 bla
share|improve this answer

Take a look at pkill, if available.

share|improve this answer
+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

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>

share|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 – Anders Jun 29 '10 at 9:51
this way you are killing the process by his pid but by this name. – TheHippo Jun 29 '10 at 9:55

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"
share|improve this answer
This does not kill it by its name. – superuser0 Apr 8 '13 at 19:10
Not intended to kill, I just noticed no one had answered his other question, namely how to find "bla" without finding "blabla". – Philip Kearns Apr 8 '13 at 22:28

You must log in to answer this question.