netstat
Running service in TCP port
netstat -nltp
Internet gateway
netstat -rn
netstat -rn | grep default
Connected IP address
netstat -ntu|awk '{print $5}'|cut -d: -f1 -s|sort|uniq -c|sort -nk1 -r
Alive connection for HTTP service
netstat -ant | grep -E ':80|:443' | grep -v grep | wc -l
Watch connections
watch 'for port in 80 443; do
echo -n "port $port: "
netstat -ant | grep -E ":$port" |
grep -v grep | wc -l
done'