在OSX内部(10.8.3)netstat show在端口上监听套接字,但是lsof不会:
> iMac:callsfreecalls-apple alex$ lsof -Pnl +M -i4|grep 5060 > iMac:callsfreecalls-apple alex$ sudo netstat -lntp udp|grep 5060 > Password: udp4 18546 0 *.5060 *.*
请指教。
sudo没有帮助:
> server:sites alex$ > server:sites alex$ ssh 192.168.0.58 Password: Last > login: Tue Jun 4 10:26:04 2013 > iMac:~ alex$ sudo lsof -Pnl +M -i4 | > grep 5060 Password: > iMac:~ alex$ netstat -lntp udp | grep 5060 udp4 > 18546 0 *.5060 *.* > iMac:~ alex$
你需要使用lsof sudo来查看其他用户的进程(OTOH你不需要使用netstat sudo ):
$ netstat -lntp udp | grep 5353 udp6 0 0 *.5353 *.* udp4 0 0 *.5353 *.* $ lsof -Pnl +M -i4 | grep 5353 # Won't work $ sudo lsof -Pnl +M -i4 | grep 5353 # Will work mDNSRespo 94183 65 8u IPv4 0xca78f18f22d6d11b 0t0 UDP *:5353