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

About Gaurav Bhardwaj

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.

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.

(+1 rating, 1 votes)
You need to be a registered member to rate this.
1 Comment Views Tweet it!
Do you want to know how to develop your skillset to become a sysadmin Rockstar?
Subscribe to our newsletter to start Rocking right now!
To get you started we give you our best selling eBooks for FREE!
1. Introduction to NGINX
2. Apache HTTP Server Cookbook
3. VirtualBox Essentials
4. Nagios Monitoring Cookbook
5. Linux BASH Programming Cookbook
6. Postgresql Database Tutorial
and many more ....
I agree to the Terms and Privacy Policy

1
Leave a Reply

avatar
1 Comment threads
0 Thread replies
0 Followers
 
Most reacted comment
Hottest comment thread
1 Comment authors
Chad Wick Recent comment authors

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

  Subscribe  
newest oldest most voted
Notify of
Chad Wick
Member
chadwick

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