netstat summarized into net states.
netstat -an | \ perl -ne 'if (/(TIME|FIN|EST|SYN|CLO)\S*/) { $s = $&; $h{$s}++; } END { print map { "$_ = $h{$_}\n" } keys(%h); }'

Replies are listed 'Best First'.
Re: netstate (improved)
by Aristotle (Chancellor) on Apr 02, 2003 at 21:51 UTC
    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.