2016年5月26日 星期四

Netstat For Network Statistics

Format:


NETSTAT [-a] [-e] [-n] [-s] [-p proto] [-r] [interval]

  -a            Displays all connections and listening ports.
  -e            Displays Ethernet statistics. This may be combined with the -s
                option.
  -n            Displays addresses and port numbers in numerical form.
  -o            Displays the owning process ID associated with each connection.
  -p proto      Shows connections for the protocol specified by proto; proto
                may be any of: TCP, UDP, TCPv6, or UDPv6.  If used with the -s
                option to display per-protocol statistics, proto may be any of:
                IP, IPv6, ICMP, ICMPv6, TCP, TCPv6, UDP, or UDPv6.
  -r            Displays the routing table.
  -s            Displays per-protocol statistics.  By default, statistics are
                shown for IP, IPv6, ICMP, ICMPv6, TCP, TCPv6, UDP, and UDPv6;
                the -p option may be used to specify a subset of the default.
  interval      Redisplays selected statistics, pausing interval seconds
                between each display.  Press CTRL+C to stop redisplaying
                statistics.  If omitted, netstat will print the current
                configuration information once.


Example
A Look all content
netstat 
Proto Recv-Q Send-Q Local Address               Foreign Address             State
tcp        0      0 127.0.0.1:6666              127.0.0.1:48858             ESTABLISHED
tcp        0      0 127.0.0.1:13666             127.0.0.1:44115             ESTABLISHED
tcp        0      0 127.0.0.1:7777              127.1.1.2:20247             ESTABLISHED

B Look TCP connection

netstat -tn | head

Proto Recv-Q Send-Q Local Address               Foreign Address             State
tcp        0      0 127.0.0.1:6666              127.0.0.1:48858             ESTABLISHED
tcp        0      0 127.0.0.1:13666             127.0.0.1:44115             ESTABLISHED
tcp        0      0 127.0.0.1:7777              127.1.1.2:20247             ESTABLISHED
tcp        0      0 127.0.0.1:13666             127.0.0.1:44124             ESTABLISHED




C  LOOK UDP connection

netstat -un | head

udp        0      0 127.0.0.1:53925             127.0.0.1:14756             ESTABLISHED
udp        0      0 127.0.0.1:48294             127.0.0.1:14756             ESTABLISHED
udp        0      0 127.0.0.1:50087             127.0.0.1:14756             ESTABLISHED
udp        0      0 127.0.0.1:60208             127.0.0.1:14756             ESTABLISHED

udp        0      0 127.0.0.1:46913             127.0.0.1:14756             ESTABLISHED



D: Look Process 
Proto Recv-Q Send-Q Local Address           Foreign Address         State       PID/Program name
tcp        1      0 ramesh-laptop.loc:47212 192.168.185.75:www        CLOSE_WAIT  2109/firefox
tcp        0      0 ramesh-laptop.loc:52750 lax:www ESTABLISHED 2109/firefox


REference
netstat-command-examples
Search IP connect







沒有留言:

張貼留言