Using netstat to find largest number of established connections
To find out the largest number of established connections you can simply use something like
netstat -an | grep ‘ESTABLISHED’ | awk ‘{print $4}’ | cut -d: -f1 | uniq -c | sort -rn | head -n 1
3 192.168.1.2
3 192.168.1.2
To see the list of the top 10
netstat -an | grep ‘ESTABLISHED’ | awk ‘{print $4}’ | cut -d: -f1 | uniq -c | sort -rn | head -n 10
2 192.168.1.2
2 192.168.1.2
How to view all
netstat -an | grep ‘ESTABLISHED’ | awk ‘{print $4}’ | cut -d: -f1 | uniq -c | sort -rn
3 192.168.1.2
3 192.168.1.2
You can also view all but have pages so you can view each in detail
netstat -an | grep ‘ESTABLISHED’ | awk ‘{print $4}’ | cut -d: -f1 | uniq -c | sort -rn | more
8 192.168.1.2
8 192.168.1.2
You can show the port with:
netstat -an | grep ‘ESTABLISHED’ | awk ‘{print $4}’ | uniq -c | sort -rn
1 192.168.1.2:58632
1 192.168.1.2:58631
1 192.168.1.2:58629
1 192.168.1.2:58628
1 192.168.1.2:58627
1 192.168.1.2:58613
1 192.168.1.2:55154
1 192.168.1.2:48673
1 192.168.1.2:58632
1 192.168.1.2:58631
1 192.168.1.2:58629
1 192.168.1.2:58628
1 192.168.1.2:58627
1 192.168.1.2:58613
1 192.168.1.2:55154
1 192.168.1.2:48673
Leave a Reply
You must be logged in to post a comment.