Linux 101 : Netstat - A tool for troubleshooting networks and sockets

We could use the netstat tool for displaying various information related to our network.


Sockets are an interface between programs across the network.
The main two types of sockets are TCP and UDP.
  • TCP : provides a system that allows two communicating application to know whether data was sent successfully.
  • UDP : is lighter than TCP because it doesn't provide a verification system for packets like TCP.
Using netstat to display network interfaces:

We display the network interfaces on a system using:

Displaying the routing table:

To display the routing table we use:

Display the process ID:

To display the IDs of the processes that own sockets on a system, we use:

Displaing the listening sockets:

To display the sockets that are listening on a certain port, waiting for incoming connections, we use:

Displaying TCP protocol socket:

To display the TCP protocol sockets, we use:

Displaying TCP protocol socket:

To display the UDP protocol sockets, we use:

Displaying sockets for a certain network interface:

To display the sockets for a specific network interface, we use:


Leave as a comment: