**一、查看哪些IP连接本机** netstat -an **二、查看TCP连接数** **1)统计80端口连接数** ~~~ netstat -nat|grep -i "80"|wc -l ~~~ **2)统计httpd协议连接数** ~~~ ps -ef|grep httpd|wc -l ~~~ **3)统计已连接上的,状态为“established** ~~~ netstat -na|grep ESTABLISHED|wc -l ~~~ **4)查出哪个IP地址连接最多,将其封了.** ~~~ netstat -na|grep ESTABLISHED|awk {print $5}|awk -F: {print $1}|sort|uniq -c|sort -r +0n netstat -na|grep SYN|awk {print $5}|awk -F: {print $1}|sort|uniq -c|sort -r +0n ~~~ > 原文链接:[https://blog.csdn.net/he\_jian1/article/details/40787269](https://blog.csdn.net/he_jian1/article/details/40787269) **5)centOS服务器 netstat命令 查看TCP连接数信息** ~~~ netstat -an |grep 'ESTABLISHED' |grep 'tcp' |wc -l ~~~ > 原文链接:[https://blog.csdn.net/slovyz/article/details/47019221](https://blog.csdn.net/slovyz/article/details/47019221)