Netstat Command in Linux














































Netstat Command in Linux



NetStat (Networking Statistics) is a command-line tool for monitoring network connections both incoming and outgoing as well as viewing routing tables, network statistics, etc. 

 
 Usage of netstat: 

1. Listing all the LISTENING PORTS of TCP and UDP: 

Listing all the Listening ports (both TCP and UDP) can be done using the netstat -a command. 

 

2. Listing all the PORTS of the only TCP: 

To list only the TCP port connections, netstat -at is used. 

  

3. Listing all the PORTS of the only UDP: 

To list only the TCP port connections, netstat -au is used. 

 

4. Listing all the existing LISTENING CONNECTIONS: 

To list all the listening ports, netstat -l is used. 


 

5. Listing all the LISTENING PORTS of the only TCP: 

To list all the listening ports under TCP, netstat -lt is used.  

  

6. Listing all the LISTENING PORTS of the only UDP: 

To list all the listening ports under UDP, netstat -lu is used. 


 
 

7. Listing all the LISTENING PORTS of the only UNIX: 

To list all the listening ports of UNIX, netstat -lx is used.  


 

8. Showing Statistics by PROTOCOL: 

To show the network statistics for each protocol, the netstat -s command is used. 

 

 

9. Showing Statistics by TCP PROTOCOL: 

To show the network statistics for TCP protocol, the netstat -st command is used.  


 

10. Showing Statistics by UDP PROTOCOL: 

To show the network statistics for UDP protocol, the netstat -su command is used. 

 


 

11. Displaying IPv4 and IPv6 information: 

To display the IPv4 and IPv6 information of the network, the netstat -g command is used. 

 


Comments