Hello Friends,
In this tutorial, you will learn the following :
- How to check which process/application is using a particular port on Windows
Here the last column is telling the process id of the process which is using port 8080.
tasklist | findstr javaw.exe
In this tutorial, you will learn the following :
- How to check which process/application is using a particular port on Windows
- How to check which port is being used by a particular process/application on Windows
How to check which process/application is using a particular port on Windows
Step 1 - Find the process id of the process which is using given port
Syntax
netstat -aon | findstr <port_number>
-a Displays all connections and listening ports.
-o Displays owning process Id associated with each connection.
-n Displays addresses and port numbers in numerical forms
Example
On my system,it displays following output.My tomcat is up and running on port 8080 within eclipse and I executed following command.netstat -aon | findstr 8080
Here the last column is telling the process id of the process which is using port 8080.
Explanation
netstat -aon
Will give you a list of process Ids which are using given port.
findstr 8080
findstr is functionally equivalent to grep command on Linux.From the output of netstat ,findstr will give the lines which have word 8080 in it.
Step 2 - Find process/application name which is using given port using process id found in the step 1
Syntax
tasklist | findstr <PID>
This will give you the application name which is using that port.
tasklist | findstr 9260
Here javaw.exe is the procecss which is using port 8080.
Example
On my system,I used following command to check which process belongs to process id 9260.tasklist | findstr 9260
Here javaw.exe is the procecss which is using port 8080.
How to check which port is being used by a particular process/application on Windows
Step 1 - Find process id of the process which is using process with given name.
Syntax
tasklist | findstr <application_name/process_name>
Example
On my system,I executed following command to find first process id of process with name javaw.exetasklist | findstr javaw.exe
Step 2 - Find port which is being used by the process id found in step 1.
Syntax
netstat -aon | findstr <PID>
Example
On my system,to find which port is being used by process with process id 9260.
netstat -aon | findstr 9260
As you can see in above output that process 9260 is using port 8080.
Summary
So in this tutorial,you learnt
- Use of netstat command with -aon options together with findstr command to find out which process is using a particular port and vice versa.
Thanks for reading.Share it with someone you think it might be helpful.
Feel free to post any questions in comments section or to share this post with anyone.
Also,if you like JavaSolutionsGuide and want to contribute,go ahead and
- Write an article
- Share with me at javasolutionsguide@gmail.com and
- See Your Article Getting Published on main Page of JavaSolutionsGuide with your name.
Feel free to post any questions in comments section or to share this post with anyone.
Also,if you like JavaSolutionsGuide and want to contribute,go ahead and
- Write an article
- Share with me at javasolutionsguide@gmail.com and
- See Your Article Getting Published on main Page of JavaSolutionsGuide with your name.