By default, the netstat command truncates hostnames in it's output. How can this truncation of hostnames be disabled in the output of the netstat command?


On older versions of OSX and Ubuntu 10.04/16.04, use the -W flag:

netstat -W

On older versions of Linux and OSX 10.13.3, use the -T flag:

netstat -T

On Windows 7/8, use the -f flag:

netstat -f

  • You might want to specify your operating system. netstat does not have a -W option on Windows 7 (or apparently on Linux) ... – DavidPostill Apr 7 '15 at 8:45
  • @DavidPostill Updated my answer. Added Linux-specific information. Can you test on Windows 7 if the -T flag is accepted? I don't have access to a Windows 7 environment. – Brandon Galbraith Apr 7 '15 at 16:07
  • @BrandonGalbraith: Win 7's netstat accepts -T, but interprets it as -t: Displays the current connection offload state. netstat -W isn't accepted, i.e. it shows the help. See computerhope.com/netstat.htm – mpy Apr 7 '15 at 17:25
  • @mpy I believe the -f flag works on Windows 7. I'll test later today on a VM. – Brandon Galbraith Apr 7 '15 at 17:35
  • @BrandonGalbraith: Oh yes, looks good! – mpy Apr 7 '15 at 18:27

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.