1
2
3
4
5
6
7
8
9
10
11
12
#!/bin/bash
cd ~
echo >shadowsocks_clients.txt
for ((i=9101; i<9105; i++)); do
echo ${i}: >>shadowsocks_clients.txt
lsof -i -n -P | egrep -c ":${i}.+ESTABLISHED" >>shadowsocks_clients.txt
lsof -i -n -P | egrep ":${i}.+ESTABLISHED" >>shadowsocks_clients.txt
echo >>shadowsocks_clients.txt
echo >>shadowsocks_clients.txt
done

cat shadowsocks_clients.txt