Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

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 stackoverflow.com 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
add comment

4 Answers

killall bla

to force it:

killall -9 bla
share|improve this answer
add comment

Take a look at pkill, if available.

share|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
add comment

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 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. –  TheHippo Jun 29 '10 at 9:55
add comment

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
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.