Thursday, February 4, 2016

How to kill all processes via grep in once (CENTOS)

Run this command.

sample process is the httpd

# ps aux | grep 'httpd' | grep -v grep | awk '{print $2}'

This will output all process ID only.

Then run this to kill all processes.


# kill -9 `ps aux | grep 'httpd' | grep -v grep | awk '{print $2}'`

Done.


2 comments: