Command referencenetstat
netstat command (Windows / CMD)
What it does
Display active connections, listening ports, routing data, and protocol statistics. Searches for the netstat command cmd windows usually need CMD syntax, practical switches, and notes on how it compares with PowerShell or Linux alternatives. This page covers syntax, common options, and copyable examples for Command Prompt.
Display active connections, listening ports, routing data, and protocol statistics.
Syntax
netstat [-a] [-b] [-e] [-n] [-o] [-p protocol] [interval]
Common options
| Flag / option | Meaning |
|---|---|
| -a | Show connections and listening ports. |
| -n | Keep addresses and ports numeric. |
| -o | Include owning process IDs. |
| -b | Show executables involved; elevation is usually required. |
| -r | Display the routing table. |
Practical examples
Ports and PIDs
netstat -ano
Lists numeric endpoints and owning PIDs.
Find a port
netstat -ano | findstr ":8080"
Filters rows involving port 8080.
Routing table
netstat -r
Shows IPv4 and IPv6 routes.
Linux ↔ Windows equivalent
Closest match: ss (Linux / bash / sh / zsh). Inspect network sockets, listeners, and connection statistics.
Common mistakes
- Confusing a PID with an executable name; correlate it with tasklist.
- Running `-b` without elevation and expecting complete output.
Related commands
- ipconfigDisplay and manage Windows IP configuration and DNS client state.
- tasklistList local or remote running processes with selectable fields and filters.
- ssInspect network sockets, listeners, and connection statistics.
- pingTest reachability and measure response time with ICMP echo requests.
- curlTransfer data to or from URLs using many network protocols.
- sshOpen a secure remote shell or run a command over SSH.
- pingTest IP reachability and measure round-trip response time.
- Invoke-WebRequestSend HTTP and HTTPS requests and return response metadata and content.
FAQ
What does netstat do in Command Prompt?
Display active connections, listening ports, routing data, and protocol statistics.
How do I run netstat in CMD?
Open Command Prompt and follow `netstat [-a] [-b] [-e] [-n] [-o] [-p protocol] [interval]`; quote paths containing spaces.
What is a practical netstat example in CMD?
Try `netstat -ano` — Lists numeric endpoints and owning PIDs.
Can netstat be used in a batch file?
Yes. Check its exit code and escape CMD metacharacters when input is variable.
Browse the full Linux and Windows command reference to search more bash, CMD, PowerShell, Conda, and GitHub CLI commands.