Wednesday, May 12, 2010

How to kill TCP client connections

Several times we are faced with a large number of TCP connections from the same source IP.
How to kill that connections?

This is an easy way:

$ for i in `lsof -i tcp@client_ip_address| awk '{print $2}'`; do kill -9 $i; done


See also : tcpkill