This post is over a year old, some of this information may be out of date.
Sometimes you want to see how many open or active connections are currently running on a server.
netstat
netstat -an | grep ESTABLISHED | wc -l
# Outputs
7
watch
If you want to have a watcher setup that refreshes every second, run the following in a terminal window:
watch -n1 -d "netstat -an | grep ESTABLISHED | wc -l"
# Outputs
Every 1.0s: netstat -an | grep ESTABLISHED | wc -l Wed Jan 3 13:28:28 2018
7