通过netstat获取:
netstat -n | awk ‘/^tcp/ {++state[$NF]} END {for(key in state) print key,"\t",state[key]}’
通过ss获取:
ss -ano | awk ‘/^tcp/ {++state[$2]} END {for(key in state) print key,"\t",state[key]}’
linux tcp状态统计
最新推荐文章于 2021-05-13 05:57:11 发布
通过netstat获取:
netstat -n | awk ‘/^tcp/ {++state[$NF]} END {for(key in state) print key,"\t",state[key]}’
通过ss获取:
ss -ano | awk ‘/^tcp/ {++state[$2]} END {for(key in state) print key,"\t",state[key]}’