Windows

How to check which Process is using port 8080 or any other port and vice versa on Windows

Hello Friends,

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

port 8080

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

port 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.

Example

On my system,I used following command to check which process belongs to process id 9260.

tasklist | findstr 9260

port 8080

Here javaw.exe is the process 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.exe

tasklist | findstr javaw.exe

port 8080

Here 9260 is the process id of the process 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

port 8080

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

Published on System Code Geeks with permission by Gaurav Bhardwaj, partner at our SCG program. See the original article here: How to check which Process is using port 8080 or any other port and vice versa on Windows

Opinions expressed by System Code Geeks contributors are their own.

Gaurav Bhardwaj

Gaurav has done Masters in Computer applications(MCA) and is working in Software development field for more than 7 years in Java/J2EE technologies. He is currently working with one of top MNC. He has worked on various frameworks like Struts, Spring, JSF, Velocity, iBatis, MyBatris, Hibernate, Junit, Dozzer. He likes to explore new technologies and share his thoughts by writing technical blog. He is founder of JavaSolutionsGuilde.blogspot.com.
Subscribe
Notify of
guest

This site uses Akismet to reduce spam. Learn how your comment data is processed.

1 Comment
Oldest
Newest Most Voted
Inline Feedbacks
View all comments
chadwick
chadwick
5 years ago

would love a script that just chews this all up for you and spits out a completed table

Back to top button