One line Linux command to kill all instances of a program or script running in the background

This one liner command that runs a "kill -9" to all background processes that matched a given search string.

ps -ef | grep [search string] | awk '{print $2}' | xargs kill -9

If you are killing a script, use the script file name as the search string.

You might want to test out with the command below to see if the awk '{print $2}' is passing the PID column to the xargs command. If it is not passing the right data, you need to change the "$2" to select the correct column output from the "ps -ef" command.


Popular posts from this blog

How to recalibrate your Samsung Note 4 battery

A Better SKMEI 1358 Instructions Manual

How to import Tasker projects, profiles, tasks and scenes

How to turn your Windows 7 laptop or dekstop into a WiFi repeater or extender

A Better SKMEI 1418 / 1427 Instructions Manual