Skip to content

netstat command

netstat (Network Statistics) is a command-line network utility tool found in the Windows command prompt (cmd).^[600-developer__tools__windows__win-cmd.md] It is used to display network connections, routing tables, and a variety of network interface and protocol statistics.^[600-developer__tools__windows__win-cmd.md]

Syntax

A common usage of the command involves combining several flags to display detailed information about active ports and processes:

netstat -abno

Parameters

When executed with the flags above, the command performs the following:

  • -a: Displays all active TCP connections and the TCP and UDP ports on which the computer is listening.
  • -b: Displays the executable involved in creating each connection or listening port. In some cases, well-known executables host multiple independent components, and in these instances, the sequence of components involved in creating the connection or listening port is displayed.
  • -n: Displays addresses and port numbers in numerical form (prevents attempts to determine the name of the host or port).
  • -o: Displays the owning process ID (PID) associated with each connection.^[600-developer__tools__windows__win-cmd.md]

Use Cases

The primary function of the netstat command in this context is to identify and troubleshoot network resource usage. By using the specific flag combination, users can effectively determine which specific ports are currently in use and identify the corresponding executable or process responsible for them.^[600-developer__tools__windows__win-cmd.md]

  • [[Command Line Interface]]
  • [[Process ID]]
  • [[Port (computer networking)]]

Sources

  • 600-developer__tools__windows__win-cmd.md