How to Find Open Ports Using Command Prompt

April 11, 2025 / Command Line

In this article, you will find how to check open ports using command prompt. Checking open ports on your Windows system can help recognize network issues, test firewall configurations, and monitor active connections.

Follow the steps:

  1. Open Command Prompt:
    1. Press Windows + R, type cmd, and press Enter.
      cmd
    2. Alternatively, you can search for Command Prompt in the Start Menu and run it as Administrator (Right-click ? Run as administrator).
  2. Check for open ports using netstat:
    Use the netstat command with suitable flags to view open ports:

    netstat -an | find “LISTEN”

    Explanation:

    • netstat: Shows network connections and listening ports.
    • -a: Displays all connections and listening ports.
    • -n: Displays addresses and port numbers in numeric form.
    • find “LISTEN”: Filters the output to show only listening ports.
      You’ll see output like:

        TCP    0.0.0.0:80           0.0.0.0:0              LISTENING
        TCP    127.0.0.1:3306       0.0.0.0:0              LISTENING

      This means ports 80 and 3306 are open and listening.

  3. Find the application using the Port
    1. To classify which application is using a specific port, use:
      netstat -aon | findstr :<port_number>

      For example:

      netstat -aon | findstr :80
    2. The output will show a PID (Process ID). To find the application:
      tasklist /FI “PID eq <pid_number>”

      Example:

      tasklist /FI “PID eq 1234”

      This will display the process using that port.

Optional: Use PowerShell Alternative
You can also use PowerShell with this command:

Get-NetTCPConnection | Where-Object {$_.State -eq “Listen”}

Useful Tip:
If you doubt a firewall is blocking a port, ensure it is allowed through Windows Defender Firewall:

  • Go to Control Panel > Windows Defender Firewall > Advanced Settings.
  • Create an Inbound Rule for the specific port if required.

If you need help examining open ports or troubleshooting network issues, feel free to reach out to our support team.

Complete your Linux network setup! Check out How to add additional SMTP ports

Spread the love