How to check which application is using which port

by Veera on October 4, 2009

in How To

Today I found an easy way to check which application is using which port in my system. Here I’m sharing the steps. These steps are applicable for the Windows Operating System.

Checking which application is using a port:

  1. Open the command prompt – start >> run >> cmd or start >> All Programs >> Accessories >> Command Prompt.
  2. Type netstat -aon | findstr “[port_number]“. Replace the [port_number] with the actual port number that you want to check and hit enter.
  3. If the port is being used by any application, then that application’s detail will be shown. The number, which is shown at the last column of the list, is the PID  (process ID) of that application. Make note of this.
  4. Type tasklist | findstr “[PID]“. Replace the PID with the number from the above step and hit enter.
  5. You’ll be shown the application name that is using your port number.

Checking which port is being used by a application:

This is exactly the reverse of the above steps.

  1. Open the command prompt – start >> run >> cmd or start >> All Programs >> Accessories >> Command Prompt.
  2. Type tasklist | findstr “[application_name]“. Replace the [application_name] with the application that you want to check (for example, apache) and hit enter.
  3. Make note of the PID (second column) from the details shown.
  4. Type netstat -aon | findstr “[PID]“. Replace the [PID] from the above step and hit enter.
  5. You’ll be shown the application detail and the corresponding port to which it is listening.
Follow me on Twitter to get notified whenever I update this blog.

{ 7 comments }

David Karr October 6, 2009 at 7:00 AM

It appears that “tasklist” only shows the name of the executable. If you tend to use an executable like “java.exe” that there will be multiple instances of, this won’t tell you which instance it is. In order to get that kind of information, you can use SysInternal’s “Process Explorer”, which will show you the entire command line. I imagine there might be a native Windows tool that can do this, but I don’t know what it would be.

Veera October 6, 2009 at 8:44 AM

@ David Karr

Thanks for the information.

The techqnique in my post is the quick and dirty way to find out the port number. I’m sure that the tools such as “Process Explorer” could do much more than just finding out the port number!

James October 6, 2009 at 9:55 AM

Thanks for the tips.

Veera October 6, 2009 at 10:19 AM

@ James

You’re welcome.

Ryanoxr November 17, 2009 at 4:15 AM

Wow!! Easiest answer finding crusade on the interwebs to date! Thanks for the info!

Veera November 17, 2009 at 7:42 AM

you are welcome.

Chenna February 10, 2010 at 9:45 AM

Good and easy way to identify almost all applications. Thanks Veeru.

Comments on this entry are closed.

Previous post:

Next post: