How to kill all processes with a given partial name?

Issue

I want to kill all processes that I get by:

ps aux | grep my_pattern

How to do it?

This does not work:

pkill my_pattern

Solution

Use pkill -f, which matches the pattern for any part of the command line

pkill -f my_pattern

Just in case it doesn’t work, try to use this one as well:

pkill -9 -f my_pattern

Answered By – Dor Shemer

This Answer collected from stackoverflow, is licensed under cc by-sa 2.5 , cc by-sa 3.0 and cc by-sa 4.0

Leave a Reply

(*) Required, Your email will not be published