3
$ netstat --version
net-tools 1.60
netstat 1.42 (2001-04-15)
Fred Baumgarten, Alan Cox, Bernd Eckenfels, Phil Blundell, Tuan Hoang and others
+NEW_ADDRT +RTF_IRTT +RTF_REJECT +FW_MASQUERADE +I18N
AF: (inet) +UNIX +INET +INET6 +IPX +AX25 +NETROM +X25 +ATALK +ECONET +ROSE 
HW:  +ETHER +ARC +SLIP +PPP +TUNNEL -TR +AX25 +NETROM +X25 +FR +ROSE +ASH +SIT +FDDI +HIPPI +HDLC/LAPB +EUI64 

$ netstat --wide --inet | head -5
Active Internet connections (w/o servers)
Proto Recv-Q Send-Q Local Address           Foreign Address         State      
tcp        0      0 192.168.1.11:38752      jl-in-f188.1e100.net:https ESTABLISHED
tcp        0      0 192.168.1.11:50882      lga15s44-in-f14.1e100.net:https ESTABLISHED
tcp        0      0 192.168.1.11:45874      151.101.1.69:https      ESTABLISHED

According to the netstat man page on my Ubuntu Linux:

   --numeric-ports
       shows numerical port numbers but does not affect the resolution of host or user names.

Yet, that option seems to affect the resolution of host names, too.

$ netstat --wide --inet --numeric-ports | head -5
Active Internet connections (w/o servers)
Proto Recv-Q Send-Q Local Address           Foreign Address         State      
tcp        0      0 192.168.1.11:38752      209.85.200.188:443      ESTABLISHED
tcp        0      0 192.168.1.11:50882      172.217.1.78:443        ESTABLISHED
tcp        0      0 192.168.1.11:45874      151.101.1.69:443        ESTABLISHED

I expected to see host names and port numbers.

2

I have net-tools 1.60_p20170221182432 (Gentoo) and it works as documented, so there may be a bug in the version that you have. If you have ss available, you can get very similar results using ss -4rn (-4: IPv4 only, -r: resolve names, -n: numeric service numbers); the difference will be the order that the data are displayed and some formatting details.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.