Tutorial Netstat

Valic —  June 29, 2010 — Leave a comment

Netstat (NETwork STATistics) is a command-line tool that provides information about your network configuration and activity.

1. To display the routing table:

#netstat -rn

-r : Kernel routing tables.
-n : Shows numerical addresses instead of trying to determine hosts.

2. To display the quick interfaces statistics:

#netstat -i

-i : Interface

3. To display the extended interfaces statistics:

#netstat -ie

-i : Interface
-e : Extended information

NOTE: That “netstat -ie” is equivalent to “ifconfig -a”.

4. To display all the opened network sockets:

#netstat -uta

-u : UDP
-t : TCP
-a : ALL

NOTE: The possible socket states are as follows:

ESTABLISHED : The socket has an established connection.

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

CLOSED : The socket is not being used.

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

LISTEN : The socket is listening for incoming connections.

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

UNKNOWN : The state of the socket is unknown.

5. To display all the opened network sockets (extended informations):

#netstat -aute

-a : ALL
-u : UDP
-t : TCP
-e : Extended

6.  To display all the listening state sockets:

# netstat -lt

-t : TCP
-l : Status soket

7. To display the summary statistics for each protocol

#netstat -s

-s : Summary statistics for each protocol.


Posts Twitter Facebook

Editor in Chief at Debian-Tutorials, Linux enthusiast.

No Comments

Be the first to start the conversation.

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.