Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can you find out which process is listening on a TCP or UDP port on Windows?

How can you find out which process is listening on a TCP or UDP port on Windows?

like image 384
readonly Avatar asked Sep 07 '08 06:09

readonly


People also ask

How can I tell if my UDP port is listening windows?

PortQry Command Line Port ScannerType the command portqry.exe -local to see all open TCP and UDP ports for your machine. It'll show you everything you can see with the NetStat command, plus port mappings and how many ports are in each state.


2 Answers

New answer, powershell

TCP

Get-Process -Id (Get-NetTCPConnection -LocalPort YourPortNumberHere).OwningProcess 

UDP

Get-Process -Id (Get-NetUDPEndpoint -LocalPort YourPortNumberHere).OwningProcess 

Old answer, cmd

 C:\> netstat -a -b 

(Add -n to stop it trying to resolve hostnames, which will make it a lot faster.)

Note Dane's recommendation for TCPView. It looks very useful!

-a Displays all connections and listening ports.

-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 cases the sequence of components involved in creating the connection or listening port is displayed. In this case the executable name is in [] at the bottom, on top is the component it called, and so forth until TCP/IP was reached. Note that this option can be time-consuming and will fail unless you have sufficient permissions.

-n Displays addresses and port numbers in numerical form.

-o Displays the owning process ID associated with each connection.

like image 166
Brad Wilson Avatar answered Sep 23 '22 09:09

Brad Wilson


There's a native GUI for Windows:

  • Start menu → All ProgramsAccessoriesSystem ToolsResource Monitor

  • or run resmon.exe,

  • or from TaskManagerPerformance tab.

Enter image description here

like image 22
bcorso Avatar answered Sep 21 '22 09:09

bcorso