Recent Changes - Search:

Softwares

.

Netstat


netstat example

  shibu@shibu-laptop:~$ netstat --inet
  Active Internet connections (w/o servers)
  Proto Recv-Q Send-Q Local Address           Foreign Address         State
  tcp        0      0 10.154.58.234:1728      auckland.ubuntu.com:www TIME_WAIT
  tcp        1      1 10.154.58.234:3624      rockhopper.ubuntu.c:www LAST_ACK
  tcp        1      1 10.154.58.234:4819      forster.canonical.c:www LAST_ACK

  shibu@shibu-laptop:~$ netstat --inet --listening
  Active Internet connections (only servers)
  Proto Recv-Q Send-Q Local Address           Foreign Address         State
  tcp        0      0 *:domain                *:*                     LISTEN
  tcp        0      0 localhost:3422          *:*                     LISTEN
  udp        0      0 *:domain                *:*

  shibu@shibu-laptop:~$ netstat --inet
  Active Internet connections (w/o servers)
  Proto Recv-Q Send-Q Local Address           Foreign Address         State
  tcp        1      1 10.154.58.234:3624      rockhopper.ubuntu.c:www LAST_ACK

  shibu@shibu-laptop:~$ netstat --inet --all
  Active Internet connections (servers and established)
  Proto Recv-Q Send-Q Local Address           Foreign Address         State
  tcp        0      0 *:domain                *:*                     LISTEN
  tcp        0      0 localhost:3422          *:*                     LISTEN
  tcp        0      0 10.154.58.234:1141      72.14.253.93:www        TIME_WAIT
  tcp        0      0 10.154.58.234:3098      www.hostmysite.com:www  ESTABLISHED
  tcp        0      0 10.154.58.234:3099      www.hostmysite.com:www  ESTABLISHED
  tcp        0      0 10.154.58.234:3096      www.hostmysite.com:www  ESTABLISHED
  tcp        0      1 10.154.58.234:3100      www.hostmysite.com:www  SYN_SENT
  tcp        0      0 10.154.58.234:3101      www.hostmysite.com:www  ESTABLISHED
  tcp        0      0 10.154.58.234:3094      www.hostmysite.com:www  ESTABLISHED
  tcp        0      0 10.154.58.234:3093      www.hostmysite.com:www  ESTABLISHED
  tcp        0      1 10.154.58.234:2463      rv-in-f97.google.:https SYN_SENT
  udp        0      0 *:domain                *:*
  shibu@shibu-laptop:~$ 

  shibu@shibu-laptop:~$ netstat --inet --all -p
  (Not all processes could be identified, non-owned process info
  will not be shown, you would have to be root to see it all.)
  Active Internet connections (servers and established)
  Proto Recv-Q Send-Q Local Address           Foreign Address         State       PID/Program name
  tcp        0      0 *:domain                *:*                     LISTEN     -
  tcp        0      0 localhost:3422          *:*                     LISTEN     -

  shibu@shibu-laptop:~$ su -
  Password:

  root@shibu-laptop:~# netstat --inet --all -p
  Active Internet connections (servers and established)
  Proto Recv-Q Send-Q Local Address           Foreign Address         State       PID/Program name
  tcp        0      0 *:domain                *:*                     LISTEN     3855/dnsmasq
  tcp        0      0 localhost:3422          *:*                     LISTEN     3873/hpiod
  tcp        0      0 10.154.58.234:1744      ti-in-f164.google.c:www ESTABLISHED5148/firefox-bin
  tcp        0      0 10.154.58.234:2036      cg-in-f103.google.c:www ESTABLISHED5148/firefox-bin
  tcp        0      0 10.154.58.234:2829      td-in-f104.google.c:www ESTABLISHED5148/firefox-bin
  udp        0      0 *:domain                *:*                                3855/dnsmasq
  root@shibu-laptop:~#@}                   

netstat - Print network connections, routing tables, interface statisatics, masquerade connections, and multicast memberships

SYNOPSIS

       netstat  [address_family_options]  [--tcp|-t]   [--udp|-u]   [--raw|-w]
       [--listening|-l]     [--all|-a]     [--numeric|-n]    [--numeric-hosts]
       [--numeric-ports]           [--numeric-users]           [--symbolic|-N]
       [--extend|-e[--extend|-e]]  [--timers|-o] [--program|-p] [--verbose|-v]
       [--continuous|-c]

State

       ESTABLISHED
              The socket has an established connection.

       SYN_SENT
              The socket is actively attempting to establish a connection.

       SYN_RECV
              A connection request has been received from the network.

       FIN_WAIT1
              The socket is closed, and the connection is shutting down.

       FIN_WAIT2
              Connection is closed, and the socket is waiting for  a  shutdown
              from the remote end.

       TIME_WAIT
              The socket is waiting after close to handle packets still in the
              network.

       CLOSE  The socket is not being used.

       CLOSE_WAIT
              The remote end has shut down, waiting for the socket to close.

       LAST_ACK
              The remote end has shut down, and the socket is closed.  Waiting
              for acknowledgement.

       LISTEN The  socket is listening for incoming connections.  Such sockets
              are not included in the output unless you specify the  --listen�
              ing (-l) or --all (-a) option.

       CLOSING
              Both  sockets are shut down but we still don�t have all our data
              sent.

Edit - History - Print - Recent Changes - Search
Page last modified on April 25, 2009, at 04:47 PM