方法一:利用netstat命令 统计 TIME_WAIT/CLOSE_WAIT/ESTABLISHED/LISTEN 等TCP状态的连接数 netstat -tan |grep ^tcp |awk '{++a[$6]} END{for (i in a) print i, a[i]}' 方法二:利用ss命令 ss -s Total: 541 (kernel 0) TCP: 77 (estab 27, closed 45, orphaned 0, synrecv 0, timewait 45/0),…