I used netstat command recently, and the output is below.

netstat  -a    

proto  local address          foreign address       state

tcp         avinash-pc:0          listening
tcp            avinash-pc:0          listening
tcp   a60-274-182-61:https  close_wait
udp            *.*                   
udp    [::]:566               *.*
  1. When I did netstat -n, there was no in the output... why?
  2. What is meant by the first and second entries(local and foreign address are both on my computer)
    • i.e. why is my computer connecting to itself?
  3. What is meant by . of 3rd entry and [::] of 4th entry?

from netstat -h:

-a            Displays all connections and listening ports.

As in both current connections and listening ports (half open).

-n            Displays addresses and port numbers in numerical form.

As in, do not resolve addresses to host names.

Your computer can and regularly does connect to itself, usually for IPC or administrative tasks.

*.* = All IPv4 addresses (it's listening, so accept connections from any IPv4)
[::] = All IPv6 addresses (same reason as the last).

  • ...thanks but ...1. i think u didn't understand my first question...i know that -n gives numerical output...what i am saying is that when i used netstat -n entries of second form were displayed as ip addresses but the entry row corresponding was not there...i.e. in tcp protocol first column contained just and 2. also i read that ports above 1024 are used only for connections with remote computers ...but in first row my computer connects to itself using a port above 1024 – Avinash Kumar Dec 20 '11 at 7:24
  • 1. -a switch adds "listening" connections, which the "" is, it's not "established". When running netstat without -a those "listening" entries will not be displayed. 2. What you read was wrong. Ports under 1024 are reserved for privileged communication (leaving 1024 and up for privileged or non-privileged); has nothing to do with remote vs local communication. – Chris S Dec 20 '11 at 13:24

netstat -a vs netstat -n

The -a options shows listening connections on your system. The -n option disables name resolution. You can combine the two options like netstat -a -n. Then you would disable name resolution, and see ports your system is listening on.

What is meant by the first and second entries

The important piece is the last column, which states listening. Your computer is accepting incoming connections on tcp/1107 and tcp/134.

What is meant by . of 3rd entry and [::] of 4th entry?

Again it is just ports open for listening, but UDP is displayed differently because it isn't connection based.

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.