Last Updated: February 25, 2016
·
186
· Jesus Castello

Network connections

Top connections

You can use this one-liner to get a list of the top 10 ip addresses connected to your server.

netstat -ant | grep -i establ | grep ":80" | awk -F" " '{print $5}' | cut -d':' -f 1 | sort -n | uniq -c | sort -nr | head -n10

Conections per status

Using this one you can get all your connections, grouped by connections status (established/listen/...)

netstat -ant | tr -s " " | cut -d ' ' -f 6 | sort | uniq -c | grep -vE '(Fore|estab)' | sort -nr