Linux查看实时并发连接数
#创建查询脚本
vim /showconn.sh
#!/bin/bash
printf "Let's look this View\n"
printf "****************************************\n"
while [ 1 -le 1 ]
do
sleep 1
huihua=`netstat -antp|grep ESTABLISHED|wc -l`
waithua=`netstat -antp|grep TIME_WAIT|wc -l`
#echo -ne "SessionLinkTotal: $huihua WaitLinkTotal: $waithua\r"
printf "SessionLinkTotal: $huihua WaitLinkTotal: $waithua\r"
done
#可以单独统计会话数量
#watch -n 1 -d "netstat -antp|grep ESTABLISHED|wc -l"
#watch -n 1 -d "netstat -antp|grep TIME_WAIT|wc -l"
#watch -n 1 -d "netstat -antp|grep SYN_RECV|wc -l"
评论区