Netstat Mac OS X How To List all listening sockets

Posted by tomachi on January 12th, 2016 filed in Mac, Unix

Use -n to speed up netstat results by turning off ip to name resolution. To show all internet connections, whether ipv4 or ipv6, tcp or udp, listening, connected or closing – the lot:

netstat -Waltn | grep p[46]

Show only TCP connections:

netstat -anp tcp

To see which apps have listening sockets open:

sudo lsof  -n -P | grep LISTEN

Some other good linux ones here:

Show Process ID in Netstat Mac

Actually, you can’t but you can use LSOF which lists open files and sockets:

lsof -Pnl +M -i

Use -i4 for ip4 and -i6 for ip6. -i seems to work for all internet traffic.


sudo netstat -tulpn

Comments are closed.