netstat Command – Complete Reference (Windows)The netstat (Network Statistics) command displays active network connections, routing tables, interface stats, and port usage.
netstat [options]
| Option | Description |
|---|---|
-a |
Show all connections and listening ports |
-n |
Show addresses and ports numerically (no DNS resolution) |
-o |
Show owning process ID (PID) for each connection |
-b |
Show executable involved in each connection (requires admin rights) |
-e |
Show Ethernet statistics |
-f |
Show fully qualified domain names (FQDNs) |
-r |
Show routing table (same as route print) |
-s |
Show protocol statistics (TCP, UDP, ICMP, etc.) |
-p <proto> |
Show connections for specified protocol (TCP, UDP, TCPv6, UDPv6) |
-x |
Show NetworkDirect connections, listeners, and shared endpoints (advanced) |
-y |
Show TCP connection template (requires -s) |
interval |
Redisplay stats every <interval> seconds (e.g. netstat -e 5) |
netstat -a
netstat -an
netstat -ano
🔎 Combine with Task Manager or
tasklistto identify which app is using a port:
tasklist /fi "PID eq 1234"
netstat -b
netstat -e
netstat -r
netstat -s
netstat -p tcp
Proto Local Address Foreign Address State PID
TCP 192.168.1.5:5000 93.184.216.34:443 ESTABLISHED 1234
| Column | Description |
|---|---|
Proto |
Protocol (TCP/UDP) |
Local Address |
Your IP and port |
Foreign Address |
Remote IP and port |
State |
Connection state (e.g., LISTENING, ESTABLISHED) |
PID |
Process ID using the connection |
| Task | Command |
|---|---|
| Show all connections | netstat -a |
| Show numeric IPs/ports | netstat -an |
| Show PID of connection | netstat -ano |
| Show program name (admin) | netstat -b |
| Show Ethernet stats | netstat -e |
| Show routing table | netstat -r |
| Show protocol statistics | netstat -s |
| Filter by protocol (e.g., TCP) | netstat -p tcp |
The netstat command is an essential tool for network diagnostics, monitoring connections, and security auditing. It helps identify which processes are using network resources and aids in troubleshooting connectivity issues.