netstat -an |grep tcp View all tcp connections including LISTEN status
netstat -an |grep ESTABLISHED View all tcp connections that are being connected
If you need to count the number of connections in each state of tcp connection
netstat -an | awk '/^tcp/ {++S[$NF]} END {for(a in S) print a, S[a]}'