Skip to content

Unix netstat COMMAND

July 24, 2010

netstat COMMAND:
nestat command displays statistics information and current state of network connections, protocol, ports/ sockets and devices.

SYNTAX:
The Syntax is
netstat [options]

OPTIONS:

-s dispalys statics information about protocols.
-i dispalys statistics information about the network interface.
-r diplays routing table.
-c displays statistics information and updates every second.
-l displays information about all sockets that are in listening state.
-a displays information about all sockets that are in listening and non-listening state.
-p displays information about sockets with ProcessName and PID.

EXAMPLE:

  1. To get statistics of network connections:
    netstat

    The sample output of above command:

    Active Internet connections (w/o servers)
    Proto Recv-Q Send-Q Local Address Foreign Address State
    tcp 0 0 vhost:32803 LocalHost:smtp TIME_WAIT
    tcp 0 0 vhost:32803 google.com:http ESTABLISHED

    Where,
    Proto -Specifies the Protocol used for connection.
    Recv-Q -Specifies the Number of Bytes which are not recevied.
    Send-Q -Specifies the Number of Bytes not send to destination.
    Local Address -Specifies the local or source address and port.
    Foreign Address -Specifies the destination address and port.
    State -Specifies the current state of conection to the socket.

    • ESTABLISHED – Connection is Established.
    • TIME_WAIT – Waiting to receive packets.
    • LISTEN – Listening to establish connection.
  2. To Get Statistics of Protocols:
    netstat -s

    The Sample output of above command:

    IP:
    5193 incoming packets delivered
    4813 requests sent out
    Tcp:
    4033 segments received
    4813 segments send out
    Icmp:
    41 ICMP messages received
    178 ICMP messages sent
  3. To Get statistics of Network Interface:
    netstat -i

    The sample output of above command:

    Kernel Interface table
    Iface MTU Met RX-OK RX-ERR TX-OK TX-ERR Flg
    eth0 1500 0 1308 0 1345 0 BMRU

    This is the statistics information of Ethernet Card[eth0

Advertisements

From → Unix

Leave a Comment

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

w

Connecting to %s

%d bloggers like this: