in reply to netstate

netstat -an | perl -lne' $h{$1}++ if /((?:TIME|FIN|EST|SYN|CLO)\S*)/; END { print "$a = $b" while ($a, $b) = each %h } '
(You'll probably need to backslash the linefeeds if not on bash or zsh.)

Makeshifts last the longest.