Using Netstat to Get a List of Open Ports

Q: How can I get a list of all the open ports on my system and the programs that have them open?

A: The easiest way is to run Netstat, which is available on every Windows computer. Netstat displays all TCP and UDP connections and their respective states by default if you don’t supply any parameters. Note that this excludes ports in listening mode. Ports in listening mode are ports that a program has open but that don't necessarily have clients connected to them. To also see listening ports, run Netstat with the -a switch. By default, Netstat translates common port numbers into the protocol typically associated with them (e.g., port 25 is translated to smtp) and IP addresses are converted to their DNS names.

If you’d rather see the port and IP address numbers, use the -n switch. By default, Netstat doesn't identify the executable or process identifier (PID) associated with each port. The -b switch tells Netstat to display the specific service within the executable that opened the port. To get the PID of the process associated with each port, use the -o switch, which shows the same PID for a process as Task Manager does.

TAGS: Security
Hide comments


  • Allowed HTML tags: <em> <strong> <blockquote> <br> <p>

Plain text

  • No HTML tags allowed.
  • Web page addresses and e-mail addresses turn into links automatically.
  • Lines and paragraphs break automatically.