Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Kill random process with name

I want a way to kill a random process with a name (eg a random perl process).

What would be the best way of doing this?

I was thinkign of using something like this:

ps aux | grep PROCESS-NAME

to a file, then find a random line number, get the second column (process ID?) and kill that.

For my use it doesn't actually need to be a random one, as long as it kills one of the processes. Making it random just makes it better.

like image 558
Hintswen Avatar asked Jun 24 '26 23:06

Hintswen


1 Answers

look at the -r option of the killall command!

like image 95
lexu Avatar answered Jun 27 '26 22:06

lexu



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!