1. I'm not sure your selection is specific enough to not kill the wrong thing, but that is your concern.
2. print $8 doesn't give me the process id, I get process id from $2. Use whatever gives you the value you need.
3. There is more than one way to do this, I use xargs. I used kill -3 (
thread dump) instead of 9 since I didn't actually want to kill my process.
kri shan wrote:How to delete a pid based on the netstat of grep particular port number ?
ps -ef | grep 1234| grep java | awk '{ print $8 }' | kill -9"
1234 is the port number