Find Process ID of Process using a Port in Windows

Find Process ID of Process using given port in Windows
Once a while it happens that you try to start Tomcat and it complains “Port 8080 required by Tomcat v7.0 Server at localhost is already in use”. So that means there is already a process running in background that has occupied 8080 port. So how to identify the process in Windows task manager that is using port 8080? I am sure there must be a javaw.exe. But is there a better way to identify which process in windows is using a given port number? Yes…

How to Find Process ID of process that uses a Port in Windows

Our friend netstat will help us in identifying the process. netstat can list the running process and display information such as process id, port, etc. From this list we can filter the processes that has given port using findstr command.

List process by port number

netstat -ano | findstr 8080

Output
find process id by port number windows

Proto  Local Address          Foreign Address        State           PID
  TCP    0.0.0.0:8080           0.0.0.0:0              LISTENING       29848

  • -a – Displays all connections and listening ports.
  • -o – Displays the owning process ID associated with each connection.
  • -n – Displays addresses and port numbers in numerical form.

We can use netstat to list all the processes.
List all processes by PID

netstat -ano

Kill the Process by PID
Once we identify the process PID, we can kill the process with taskkill command.

taskkill /F /PID 12345

Where /F specifies to forcefully terminate the process(es). Note that you may need an extra permission (run from admin) to kill some certain processes.

windows-task-manager-process-task-by-port-number

Or else you can use our old trusted Windows Task Manager to kill the process for given process id. If PID is not visible in your task manager then you can enable it by Right clicking on table header under Details tab, click Select Columns and then check PID.

The post Find Process ID of Process using a Port in Windows appeared first on ViralPatel.net.



via ViralPatel.net http://ift.tt/28ME73T

No comments:

Post a Comment

If you have any question please let me know

Microsoft 365 (Office) Insider Preview Build 17715.20000 (Version 2406) Released, Here is What’s New and Fixed

UPDATE: Microsoft 365 Insider (previously known as Office Insider) Preview build 17715.20000 (version 2406) is available for download and in...