The netstat
command is a networking tool used for troubleshooting, configuration, and monitoring of connections over the network. It displays the contents of various network-related data structures for active connections. The command generates displays that show network status and protocol statistics, and it can display the status of TCP and UDP endpoints in table format, routing table information, and interface information. The command can be used with various parameters to display different types of network data, such as active TCP connections, ports on which the computer is listening, Ethernet statistics, IP routing table, and IPv4 and IPv6 statistics.
Here are some of the most commonly used parameters for the netstat
command:
-a
: Displays all active TCP connections and the TCP and UDP ports on which the computer is listening.-b
: Displays the executable involved in creating each connection or listening port.-e
: Displays Ethernet statistics, such as the number of bytes and packets sent and received.-n
: Displays active TCP connections, but addresses and port numbers are expressed numerically and do not resolve to host names or port names.-o
: Displays active TCP connections and includes the process ID (PID) for each connection.-p
: Shows connections for the specified protocol. For example,-p TCP
shows all TCP connections.-r
: Displays the contents of the IP routing table.-s
: Displays per-protocol statistics for the UDP, TCP, ICMP, and IP protocols.<interval>
: Redisplays the selected information every interval seconds. Press CTRL+C to stop the redisplay. If this parameter is omitted, this command prints the selected information only once.
The netstat
command is available on various operating systems, including Windows and Linux. It is a useful tool for network administrators to diagnose and troubleshoot network issues.