Show multiple connections to a server

If you want to list all duplicate connections to a server, in a proper fashion way, just use:

netstat -pnt | awk {' print $4'} | /bin/sed -e 's/:/ /g' | awk {'print $1'} | sort -n  | uniq -c -d

This will list how many connections every connected IP has to the server ,in all states: established, time waiting, syn, etc… If you want to show only the ones in time_wait for example, just use grep after the netstat to limit them.

netstat -pnt | grep TIME_WAIT | awk {' print $4'} | /bin/sed -e 's/:/ /g' | awk {'print $1'} | sort -n  | uniq -c -d

Leave a Reply

Your email address will not be published. Required fields are marked *