What netstat shows
netstat prints the Windows networking stack’s view of TCP and UDP endpoints: local and remote address/port pairs, connection state for TCP, and optionally the process ID (PID) owning the socket. It can also dump the routing table and interface statistics. It is snapshot-oriented unless you append an interval in seconds to refresh.
Switches you will use
| Switch | Effect | Notes |
|---|---|---|
-a | All connections and listening ports | Default without -a can hide non-listening rows depending on OS defaults—prefer -a for audits |
-n | Numeric addresses and ports | Skips reverse DNS—faster and clearer for firewalls |
-o | Include owning PID | Combine with tasklist or Task Manager Details tab |
-b | Show executable per connection | Requires elevated Administrator; can be slow and verbose |
-p tcp|udp|tcpv6|udpv6 | Filter protocol | Narrows noisy output on busy servers |
-e | Ethernet interface statistics | Bytes/discards/errors snapshot |
-r | Display routing table | Overlaps route print—same logical data |
-s | Per-protocol statistics | Useful for discard/error counters by protocol |
The usual triage line is netstat -ano: all sockets, numeric form, with PIDs.
TCP states in one glance
LISTENING means a passive open on the local port (often 0.0.0.0 or :: for all interfaces). ESTABLISHED is an active session. TIME_WAIT is normal after connections close—brief accumulation is expected; endless growth can indicate churn or scanning. CLOSE_WAIT often means the local app has not closed its side after receiving a FIN—investigate the owning process.
From PID to process name
Example: tasklist /fi "PID eq 1234" or Task Manager’s Details column. For services hosted in svchost.exe, use tasklist /svc /fi "PID eq 1234" or Services tab to see which service group owns the PID.
PowerShell alternative
Get-NetTCPConnection and Get-NetUDPEndpoint return objects you can filter (Where-Object LocalPort -eq 443, state filters, owning process). Prefer this in scripts; keep netstat for quick human-readable snapshots and recovery environments.
Related: Windows networking commands, ss on Linux, PowerShell networking, netstat vs ss.