1
2
3
4
!/bin/sh
echo '———————————————'
netstat -n | awk '/^tcp/ {++S[$NF]} END {for(a in S) print a, S[a]}'
echo '———————————————'

[root@www100 ~/manage_tools]# ./check_netstat.sh
FIN_WAIT_1 74
FIN_WAIT_2 35
LAST_ACK 8
CLOSING 15
CLOSED 1
SYN_RCVD 10
TIME_WAIT 2384

ESTABLISHED 120