linux下使用netstat和管道来获取服务端建立的ip连接数,以ss服务端(已建立的TCP连接、python)为例:
netstat -anp |grep 'ESTABLISHED' |grep 'python' |grep 'tcp'
附anp说明:
-a Show both listening and non-listening (for TCP this means established connections) sockets.
-n Show numerical addresses instead of trying to determine symbolic host, port or user names.
-p Show the PID and name of the program to which each socket belongs.