netstat
SafeConnections and listening ports
netstat -ano
Lists TCP/UDP connections and listening ports. -ano adds PIDs; pipe to findstr to filter.
Examples
netstat -ano | findstr :443PID using port 443netstat -ano | findstr LISTENINGAll listening portsnetstat -ano | findstr ":3389 "RDP port listeners and connections (the trailing space excludes :33890 and similar)tasklist /fi "PID eq 1234"Look up the process name for a PID found with netstatnetstat -abnoInclude the executable name (run as administrator)Get-NetTCPConnection -LocalPort 443 -State ListenThe PowerShell equivalent
Syntax
netstat -ano [| findstr <port|pid>]
Key points
- -a shows all connections and listeners, -n skips name resolution (faster), -o adds the PID.
- LISTENING means waiting for connections; ESTABLISHED means connected. TIME_WAIT is a just-closed connection and many of them are normally harmless.
- A local address of 0.0.0.0 listens on every interface; 127.0.0.1 accepts connections from the machine itself only.
When it does not work
- If -b says the requested operation requires elevation, reopen the prompt as administrator.
- findstr :80 also matches :8080. Add a trailing space, as in ":80 ", to narrow it.
Before you run it
Read-only.
Used when you see
Related commands
- tasklistList running processes
- Get-NetTCPConnectionPorts/connections in PS
- ssSockets and listening ports
The same reference, with no signal at all
Every command on this site, held on your device. The app adds 632 more: 1,510 commands and 120 fix flows, searchable with no connection. Free to install, no ads (some content is a one-time purchase).
Get it free on the App Store