List of 15 Best Netstat Command in Linux

Netstat command in Linux
Netstat command in Linux

The netstat command in Linux is used to monitor network connections and display statistics about them. It is a powerful tool for network troubleshooting and monitoring. It can be used to view incoming and outgoing traffic, as well as active TCP/IP connections.

Netstat also provides useful information such as the source and destination IP addresses, port numbers, packet size, etc. Additionally, it can be used to troubleshoot network-related problems such as slow response times or dropped packets. With this command, users can quickly identify potential issues with their network setup and take corrective action.

Here are some common uses of the netstat command

  1. Display all active network connections.
netstat -a
  1. Display only TCP connections.
netstat -at
  1. Display only UDP connections.
netstat -au
  1. Display network statistics for each protocol.
netstat -s
  1. Display routing table information.
netstat -r
  1. Display the PID (process identifier) and name of the program that is using a specific port.
netstat -p | grep <port number>
  1. Display the IP addresses and port numbers that are being listened on.
netstat -l
  1. To list only the listening tcp ports.
netstat -lt
  1. To list only the listening udp ports.
netstat -lu
  1. List only the listening UNIX ports.
netstat -lx
  1. List the statistics for TCP (or) UDP ports.
netstat -st
netstat -su (UDP)  List the statistics for UDP ports.
  1. To get the list of network interfaces.
netstat -i
  1. Displays all TCP connections.
netstat -t
  1. Displays addresses and port numbers in numerical format instead of resolving them to hostnames and service names.
netstat -n
  1. To get the port on which a program is running.
netstat -ap

Note that some options may require superuser privileges to execute. You can find more information about the netstat command by typing man netstat in the terminal.

Download: netstat command in linux pdf

Also Read:

What are TCP and UDP ports? How do they work?

10 Best Troubleshooting Commands to Use in Linux

4 Best Command to Clear Your Linux Terminal


No comments yet. Why don’t you start the discussion?

Leave a Reply