[Windows] Find which application is using a port

Sometimes, when we start a web server it may produce error notifying us “a specific is being used by another application”. We can change port used by server or find that application to shut it down. Here are convenient commands to find that application:

  1. Open CMD
  2. To find PID of applicaiton, type this command on CMD:
    netstat -aon | findstr 8080

    You can change “8080” to your desired port. The result will be a list of application which have “8080” like below:

    TCP    192.168.120.201:56464  192.168.120.200:8080   ESTABLISHED     8344

    The last column value “8344” (this value is just an example) will be PID of the applicaiton.  You will use this PID the find which the application is.

  3. To find the application by PID, type this command on CMD:
    tasklist | findstr 8344

    The result will be like this:

    firefox.exe                   8344 Console                    3    379,656 K

    The first column value “firefox.exe” (this value is just an example) will be the application name. Now you know which application to shut it down.

  4. When we know the name or PID, we can use following command line to kill the process:
    taskkill /IM firefox.exe /F

    Or

    taskkill /PID 8344 /F

We can aslo use Task Manager to end the task:

  1. Open Task Manager
  2. On tab Details, find the application with PID we found in above steps.
  3. Click End Task button.

Reference: veerasundar.com