Managing Windows Ports and Processes | Generated by AI

Home 2025.10

On Windows, you can check which ports are being listened to — and by which process (PID) — using netstat, and then manage or kill those processes with taskkill. This is often needed when debugging backend projects like Java Spring Boot apps, Redis, or MySQL. Here’s how:


1. Check listening ports

Run Command Prompt (cmd) or PowerShell as Administrator:

netstat -ano | findstr LISTENING

Example output:

TCP    0.0.0.0:8080     0.0.0.0:0     LISTENING     12345
TCP    0.0.0.0:3306     0.0.0.0:0     LISTENING     6789

Here:


2. Find which process that PID belongs to

You can match the PID to a process name:

tasklist | findstr 12345

Output might show:

java.exe                  12345 Console                    1     512,000 K

That means your Spring Boot app is running on port 8080.


3. Kill the process if needed

If you want to stop that process:

taskkill /PID 12345 /F

4. Typical ports for common backend services

So, if you see those ports in the netstat output, you’ll know which service is running.


👉 Pro tip: You can combine these into one command to directly find which process is using a given port (e.g., 8080):

netstat -ano | findstr :8080

Then take the PID and check it with tasklist.


Do you want me to also show you a PowerShell one-liner that directly maps ports to process names without needing to check separately with tasklist?


Back

openai/gpt-5

Donate