snippets

Killing Linux programmes by name

You're forking about with PHP - way to go! Then it spawns itself because of a bad dev script and you need to kill it in a jiffy.


29 August 2011 • 2 min read

linux php concurrency

Sometimes you need to be able to quickly kill a number of processes on the server that all share the same name.

killcli () { 
	kill -9 `ps ax | grep cli.php | grep -v grep | awk '{print $1}'`
}

Place the function inside your ~/bashrc file and then call the function name from the commandline. In this example we’d call:

# killcli


Published on 29 August 2011

linux php concurrency

Other content you may be interested in....

Use MongoDB to find a regex term inside field values.


1 min read

mongodb regex

Your shiny new SSL needs to operate on specific ports. How do you check you've installed correctly?


2 min read

security ssl

bodged with ♥ in NCL, AMS, NAP, NYC, BOS and LDN