How do I check which process is using a particular port with netstat on Windows?

I want to identify which process is listening on a specific TCP or UDP port on my Windows machine. Is there a netstat command that shows listening ports along with the process ID or name?

Looking for a reliable way to monitor netstat listening ports for troubleshooting.

@smrity.maharishsarin What works for me is running:

cmd
Copy
Edit
netstat -aon | findstr :<port>

This shows all connections and the PID for each.

Once I get the PID, I just open Task Manager → Details tab, and match the PID to the process name.

It’s a bit manual, but accurate and built-in.

I do something similar, but I like to pair it with tasklist in the terminal itself:

c
Copy
Edit
netstat -aon | findstr :8080
tasklist /FI "PID eq <the-pid-you-found>"

This way I don’t even have to open Task Manager.

It’s super handy when I’m scripting diagnostics or working over remote desktop.

For deeper troubleshooting, I use PowerShell with this one-liner:

powershell
Copy
Edit
Get-Process -Id (Get-NetTCPConnection -LocalPort 8080).OwningProcess

It’s cleaner and gives me the process name directly.

Only caveat, it requires PowerShell 5+ and sometimes admin rights, but it’s worth it when dealing with dozens of ports.