![Forrest logo](/images/logo.png)
netstat:tldr:960c0
The "netstat" command (network statistics) is a useful tool used in command-line interface and operating systems to display information about the network connections, network interfaces, routing tables, and network statistics. It allows users to monitor and troubleshoot network-related issues.
When executed without any additional options, the netstat command displays a list of currently active network connections on the system, including the protocol used (TCP or UDP), the local address and port, the remote address and port, and the current state of the connection (such as listening, established, waiting, closed, etc.).
Some common options that can be used with the netstat command include:
- "-a" option: Displays all active connections and listening ports.
- "-n" option: Shows the numerical addresses and port numbers instead of resolving them to hostnames or service names.
- "-r" option: Displays the routing table information, including the list of network destinations and the associated gateway addresses.
- "-s" option: Provides network statistics and summary information, such as the number of inbound and outbound packets, errors, dropped packets, etc.
- "-p" option: Shows the specific processes or applications associated with each active connection.
Overall, the netstat command allows users to gain valuable insights into their system's network activity, identify potential networking issues, and diagnose and troubleshoot network-related problems.