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
Kill process by name with killall and pkill First, killall accepts a process name as an argument rather than PID. And the other difference is that killall will, as the name implies, kill all instances of a named process. Contrast this to the regular kill command which only ends the processes you explicitly specify.
killall Command – kill the processes by name. By default, it will send a TERM signal. The killall command can kill multiple processes with a single command. If more than one process runs with that name, all of them will be killed.
There are two commands used to kill a process: kill – Kill a process by ID. killall – Kill a process by name.
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
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With