Skip to content

NETSTAT Windows Command Guide

The Windows netstat command is a versatile tool for displaying active network connections, routing tables, interface statistics, and other important networking information. By running netstat in the command prompt, users can quickly identify established TCP connections, view listening ports, check network interface details, and troubleshoot network-related issues. This handy command provides vital insights into a system’s network activity, making it an essential tool for network administrators, IT professionals, and anyone looking to understand and optimize their network connections on a Windows operating system.

Terminal window
netstat [option] [parameter]
OptionDescription
-aDisplays all connections and listening ports.
-bDisplays the executable involved in creating each connection or listening port.
-eDisplays Ethernet statistics.
-fDisplays Fully Qualified Domain Names (FQDN) for foreign addresses.
-nDisplays addresses and port numbers in numerical form.
-oDisplays the owning process ID associated with each connection.
-pShows connections for the specified protocol.
-rDisplays the contents of the routing table.
-sDisplays per-protocol statistics.
-tDisplays the current connection offload state.
ParameterDescription
protocolSpecifies the protocol to display. Can be TCP, UDP, TCPv6, or UDPv6.
intervalRedisplays the output every “interval” seconds.
Terminal window
netstat

Displays all active network connections and listening ports.

Terminal window
netstat -a

Displays all active TCP connections and listening ports.

Terminal window
netstat -u

Displays all active UDP connections.

Display PID and Process Name for Active Connections

Section titled “Display PID and Process Name for Active Connections”
Terminal window
netstat -b

Displays the PID and process name for each active connection.

Terminal window
netstat -e

Displays statistics for network interfaces, including packets and bytes sent and received.

Display Active Connections in Numerical Form

Section titled “Display Active Connections in Numerical Form”
Terminal window
netstat -n

Displays active connections in numerical form (IP addresses and port numbers).

Terminal window
netstat -r

Displays the routing table, including destination, gateway, and interface information.

To use the netstat command in Windows, execute the following command:

Terminal window
netstat --option <value>

What is the purpose of netstat in Windows?

Section titled “What is the purpose of netstat in Windows?”

The netstat command in Windows is used to display active TCP connections, listening ports, and related network statistics.

How can I display all active TCP connections using netstat?

Section titled “How can I display all active TCP connections using netstat?”

To display all active TCP connections, run the following command:

Terminal window
netstat -a

How do I list all listening ports with netstat in Windows?

Section titled “How do I list all listening ports with netstat in Windows?”

To list all listening ports, use the following netstat command:

Terminal window
netstat -an

How can I find the PID (Process ID) associated with a specific network connection using netstat?

Section titled “How can I find the PID (Process ID) associated with a specific network connection using netstat?”

To find the PID associated with a network connection, you can execute:

Terminal window
netstat -ano

How can I filter the netstat output to only display specific protocol connections, such as TCP or UDP?

Section titled “How can I filter the netstat output to only display specific protocol connections, such as TCP or UDP?”

To filter the netstat output by protocol (TCP or UDP), you can use:

Terminal window
netstat -t //for TCP connections
netstat -u //for UDP connections
  • Displaying active network connections
  • Listing listening ports
  • Showing network statistics
  • Displaying the routing table