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…
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
Code language: Bash (bash)netstat -ano | findstr 8080
Output
Code language: Bash (bash)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
Code language: Bash (bash)netstat -ano
Kill the Process by PID
Once we identify the process PID, we can kill the process with taskkill
command.
Code language: Bash (bash)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.
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.
Java URL Encoder/Decoder Example - In this tutorial we will see how to URL encode/decode…
Show Multiple Examples in OpenAPI - OpenAPI (aka Swagger) Specifications has become a defecto standard…
Local WordPress using Docker - Running a local WordPress development environment is crucial for testing…
1. JWT Token Overview JSON Web Token (JWT) is an open standard defines a compact…
GraphQL Subscription provides a great way of building real-time API. In this tutorial we will…
1. Overview Spring Boot Webflux DynamoDB Integration tests - In this tutorial we will see…
View Comments
Thanks for sharing nice article
Is there any way to kill a process using a specific port in windows using a single command?
Helpful. Thank you.