Categories
networking port windows

How do I find out which process is listening on a TCP or UDP port on Windows? [closed]

3030

How do I find out which process is listening on a TCP or UDP port on Windows?

10

  • 8

    Currports is a tool that helps search + filter too nirsoft.net/utils/cports.html

    Sep 23, 2018 at 5:00

  • 2

    I ran into this while trying to run Tomcat in debug mode under IntelliJ, the best solution for me turned out to be changing the debug transport configuration (File->Settings->Build/exe/deploy->Debugger) from “socket” to “shared memory”.

    – TMN

    Mar 28, 2019 at 15:28

  • 66

    netstat -aof | findstr :8080 (Change 8080 for any port)

    Jun 11, 2020 at 17:18

  • @DavidJesus doesn’t show process on windows 10.

    Feb 16, 2021 at 22:14

  • @SmitJohnth I use netstat -aof | findstr :3306 to find the MySQL process on Windows 10 and works like a charm.

    Mar 13, 2021 at 7:39

3480

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.

21

  • 162

    and taskkill /PID <pid> to then terminate the process, using /F if appropriate.

    Mar 4, 2013 at 20:03

  • 93

    You may have to run your command line shell as administrator, otherwise you may get an error message about insufficient privileges. Use the “Run as administrator” option when right-clicking cmd.exe.

    – Gruber

    Jul 29, 2014 at 11:20


  • 9

    Works but requires elevated permission. Shift+right click on command icon -> run as administrator

    Jun 18, 2015 at 20:53

  • 25

    Having got the PID – let’s say it’s 1234 – then you can use tasklist /fi "pid eq 1234" to find out the name and other details of the process.

    Nov 28, 2017 at 10:32


  • 7

    @RodionSychev The powershell command is expecting you to replace “portNumber” with the port number you are looking for. The error states that “portNumber” isn’t a number.

    – MattOG

    Sep 24, 2019 at 8:50

2748

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

10

  • 61

    Also shows the binding’s firewall status (last column). Very util.

    – Raphael

    Jul 2, 2014 at 17:34

  • 8

    You need to be an administrator (or in that group) to run this.

    Jan 4, 2016 at 7:40

  • 3

    @bcorso, What does binding to “unspecified address” mean?

    – Pacerier

    Jan 22, 2016 at 14:36


  • 8

    Can also be launched from Task Manager’s Performance tab, at least in Windows 10. (Have not checked other versions.)

    Oct 9, 2016 at 13:55

  • 12

    The comment of @user4836454 above is NOT correct: Resource Monitor DOES show ports with listeners, even if there is no network connection to these ports. Just look into the section “Listening Ports” instead of the section “TCP Connections”.

    – Jpsy

    Dec 28, 2017 at 9:27


306

For Windows:

netstat -aon | find /i "listening"

7

  • 44

    +1 But keep in mind, if your windows runs in a language other than english, you will have to change “listening” to the native term. E.g. netstat -aon | find /i "abhören" for german.

    – Levite

    Jun 30, 2014 at 10:29


  • 6

    In my case it didn’t work maybe because of quotes sign, but the solution netstat -aon | findstr LISTENING works perfectly!

    Nov 17, 2015 at 16:07

  • 6

    I’m getting an error while trying to run this command on W10 15063.729 with PowerShell: FIND: Parameter format not correct

    Dec 22, 2017 at 18:05


  • 4

    How is this answer relevant to “find out which process [name] is listening on a port on Windows?”

    Apr 16, 2019 at 19:56

  • 1

    Use //i instead of /i if using git bash on windows

    – joe

    Sep 2, 2019 at 7:41