I was trying to understand what the --numeric
/-n
flag of netstat does? Manual says the following about --numeric
/-n
–numeric , -n
Show numerical addresses instead of trying to determine symbolic host, port or user names.
Following is a line of output with “-n” option
tcp 0 0 :::8080 :::* LISTEN -
Following is the same line as in A but without “-n” option
tcp 0 0 *:terabase *:* LISTEN -
port 8080 in my case is associated with solr. I have no idea why it’s being listed as terabase. That’s why I am wondering how netstat determines symbolic host. It would be helpful if someone can throw light on this.
Advertisement
Answer
You’re mixing ports and hosts I believe.
The symbolic host is determined by DNS lookup, whereas the port usage is what you’ll find in /etc/services
(why you have teradata for port 8080 I don’t know – it’s usually http-alt
– but go have a look)
So, for example with -n
you could have
tcp 0 0 127.0.0.1:5432 0.0.0.0:* LISTEN
meaning something is listening on port 5432 on IP 127.0.0.1. Without -n
it would be
tcp 0 0 localhost:postgresql *:* LISTEN
which makes us much wiser, since we can now see it’s PostgreSQL on localhost.
The price for that information is that the DNS roundtrips take time…!
Cheers,