Killing a process using ps, grep and nawk

 ps ax | grep -v grep | grep PROCESSNAME | nawk '{print $1}'

This will show your processes, remove any with the word 'grep' in them, grep your PROCESSNAME, run nawk to get the pid of it.

If you pass this to kill -9, you'll kill the service:

 kill -9 `ps ax | grep -v grep | grep PROCESSNAME | nawk '{print $1}'`
unix

Edit on github
comments powered by Disqus
Click me