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 want to kill all processes with the same name that belong to a user, for example:

$ps -u user_1
2345 myapp
2346 myapp
2347 myapp
2348 myapp2
2349 myapp

I want to kill all "myapp" processes that belong to "user_1", how can I do this?

share|improve this question
To kill all processes, use killall. I'm not kidding: man killall. – cpast Jan 2 '13 at 7:14
Here's a link to a discussion on askubuntu that might answer your question. – dinesh Jan 2 '13 at 7:45

You can use the pkill command.

pkill -u user_1 myapp

Note that myapp2 won't be killed as it has a different name.

share|improve this answer

use pkill command and wild cards

pkill -u user_name 'myap*'

it will kill all processes starting with myap.

"?" - matches 0 or 1 character

"*" - matches 0 or more character

share|improve this answer
and @cpast is right. killall will do the same. – Arpit Jan 2 '13 at 7:42

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .