查看tcp連接數狀態

netstat -ant | awk '{print $6}' | grep -v established\) | grep -v Foreign | sort | uniq -c | sort -n

netstat -n | awk '/^tcp/ {++S[$NF]} END {for(a in S) print a, S[a]}'

統計80端口上有多少個TCP連接

netstat -ant | grep 80 | wc -l

TCP連接中有多少個連接狀態是ESTABLISHED

netstat -ant | grep 80 | grep ESTABLISHED| wc -l

TCP連接中有多少個連接狀態是CLOSE_WAIT

netstat -ant | grep 80| grep CLOSE_WAIT| wc -l