linux view tcp connection status

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]}'

Guess you like

Origin blog.csdn.net/weixin_42182501/article/details/100577186