$ lsof -P -i:6666
COMMAND PID USER FD TYPE DEVICE SIZE/OFF NODE NAME
openocd 4228 riguz 3u IPv4 0x163b8cdfd65fd7d7 0t0 TCP localhost:6666 (LISTEN)
$ netstat -vanp tcp | grep 6666
tcp4 0 0 127.0.0.1.6666 *.* LISTEN 131072 131072 4228 0 0x0100 0x00000006