netstat -t doesn't show connections but netstat -nt does

2.3k views Asked by At

I was using netstat to check tcp connections. When I try netstat -t | grep 210, it doesn't show me any connection (the output is empty), but when I try netstat -nt | grep 210, it shows me what I want :

tcp6       0      0 192.168.0.21:56517      192.168.0.210:9999   ESTABLISHED
tcp6       0      0 192.168.0.21:56520      192.168.0.210:9999   ESTABLISHED

I checked the man page of netstat -n, it says "Show numerical addresses instead of trying to determine symbolic host, port or user names.".

So I am suspecting in the result it shows host name instead. So I am checking the result of netstat -t, the result looks like :

tcp6 0 0 localhost:55231 ip-192-168-0-37 ESTABLISHED
tcp6 0 0 localhost:55232 ip-192-168-0-38 ESTABLISHED
...

unfortunately I didn't find any item related to the ip 192.168.0.210.

Will very appreciate it if any one has a clue what happened...

2

There are 2 answers

0
jeron On

netstat -nt shows Active Internet connections

netstat -t limits it to TCP connections.

0
dosmanak On

netstat resolves ips to names by default. with -n it show ip address and so you can see it in the grep.

From man pages

--numeric , -n
       Show numerical addresses instead of trying to determine symbolic host, port or user names.