All Posts

Windows Netstat Command

Windows Netstat Command

The netstat command in Windows is a powerful networking tool used to display network connections, routing tables, listening ports, interface statistics, etc.

Basic Syntax

The basic syntax of the command is as follows:

/> netstat [options]

netstat Command Flags

Command Description
netstat Displays active connections.
netstat -a Shows all active connections and listening ports.
netstat -n Displays addresses and port numbers in numerical form.
netstat -o Shows active connections along with the Process ID (PID).
netstat -p [protocol] Displays connections for a specific protocol (TCP, UDP, etc.).
netstat -r Displays the routing table.
netstat -s Shows network statistics by protocol.
netstat -b Displays the executable responsible for each connection.
netstat -an Shows all connections in numerical format.
netstat -ano Shows all connections with numerical addresses and PIDs.

Examples

View all active TCP connections

netstat -a

Find which process is using a specific port (e.g., port 80)

netstat -ano | findstr :80

Then, find the process using:

tasklist | findstr [PID]

Monitor live connections continuously

netstat -an 5

This command updates t