netstat output: wider columns on OS X?
I'm using netstat on OS X. How do I get wider columns?
It looks like some of information (in Local Address column) is clipped for hostnames, IP and mac address. I did not see anything in the manual. Thanks
$ netstat
Active Internet connections
Proto Recv-Q Send-Q Local Address Foreign Address (state)
tcp6 0 0 xxxx-macboo.1024 fe80::b3ac:b3c2:.1024 SYN_SENT
tcp6 0 0 2601:18c:c900:50.64154 2a04:4e42:1c::76.https ESTABLISHED
tcp4 0 0 10.0.0.11.64124 47.224.186.35.bc.https ESTABLISHED
tcp4 0 0 10.0.0.11.64120 10.0.0.6.59092 ESTABLISHED
tcp4 0 0 10.0.0.11.64106 205.245.190.35.b.https ESTABLISHED
Unfortunately I don't believe there are options to give you exactly what you want and prevent Local Address from being truncated (note that the entry beginning 2601:18c
in your example is an IPv6 address, not a MAC address). Option -W
(In certain displays, avoid truncating addresses) seems that it will give what you want but it still truncates hostnames and IPv6 addresses.
The following netstat
options can get you most of the way there:
-l
Print full IPv6 address
-n
Show network addresses as numbers...
Using a combination of those two options (netstat -ln
) will give you un-truncated IPv4 and IPv6 addresses. Once you have those, you can use, eg host
, to do a DNS lookup of the IP address in order to get the hostname if a PTR
record exists for it.