Linux Bash Kill process by path

(Last Updated On: May 31, 2020)

Linux Kill Process by PATH

function killpath() {
  ps aux | awk '{print $2"\t"$11}' | grep -oP '^[[:digit:]]*\t'"$1"'$' | awk '{print $1}' | awk '{print $1}' | xargs kill -9 2> /dev/null
}
killpath /usr/sbin/nginx

 

 

안 되길래 조금 고쳤음.