Mac equivalent of `netstat -b -n`?
OS X has a netstat
command, but it doesn't display information about the programs associated with the network connections. If you want to see that, you need to use lsof
instead. Note that it must be run as root (i.e. with sudo
) in order to see other users' programs:
sudo lsof -i
lsof
also has many options for controlling what's displayed:
sudo lsof -i tcp -nP # show TCP unly (no UDP), and don't translate IP addrs and ports numbers to names
sudo lsof -i 6tcp -stcp:listen # show only IPv6 TCP ports in the listen state
sudo lsof -i @10.11.12.13 # show only connections to/from 10.11.12.13
...see the man page for more.