Kill Apache Process
Sometimes when you shutdown the Apache server for your application, you did notice that some of the httpd process was still running as a result from ps -ef | grep httpd. To clean up the Apache process, use the command as below: -
Kill Apache Process Command
UNIX> kill -9 `ps -ef|grep httpd|grep -v grep|awk '{print $2}'`
Note: Shutdown the Apache server before you issue the command as above.
2 Comments
Thanks PurplePig for the explanation. Yes…the command works faster to kill all those httpd process rather than 1 by 1 kill :p (better save some time from here and bring up the Apache ASAP).
Leave a Comment


October 11, 2008 9:24 am
if I break down your command
kill -9 = force kill
ps -ef = process list
grep httpd = filter and only show the word httpd from the previous output
grep -v grep = filter but don’t show the word grep
awk ‘{print $2}’ = stream process previous output and print only column “2″
kill -9 ` ` = force kill process id that comes out from the command within ` `. Note, it’s not apostrophe, it’s the sign that looks like apostrophe below the tilde key. Called back apostrophe??
so, put all together in a story
kill the process id, which will be outputted from the next command within ` `, where the command is list all processes named httpd, and only print the httpd’s process ID located in column “2″.
wow. the sentence above, replaced in unix is:
kill -9 `ps -ef | grep httpd | grep -v grep | awk ‘{print $2}’`
good stuff. i used that almost everyday…
pathetic me….