Linux Windows

How to use Netstat.exe to confirm which Program uses or blocks a port

How-to-use-Netstat.exe-to-confirm-which-Program-uses-or-blocks-a-port

There are times when you will be installing an application that makes use of a particular port number. This same port number is already in use on the system. The next thing to do is to know which application or program is making use of this port number.

A Netstat.exe utility can display the PID of all connections or program that is having port conflicts. In this article, we will learn how to use Netstat.exe to confirm which Program uses or blocks a port.

This utility tool can be used to determine which process or program is listening on a given port that you intend to use. You may want to know How to change the default RDP port in Windows and How to fix a Telnet Error: Could not open a connection to the host, on the port, connect failed, and How to Protect Thunderbolt ports in Windows.

Kindly refer to the YouTube Video below

Use Netstat.exe to confirm which Program uses or blocks a port

Assuming you are setting up a WAMP server with a MySQL server port 3306. But you discover it conflicts with another process or program on the system using the same port. Follow the below steps on using netstat command to resolve this conflict.

Wamp-Port-Number

How to use netstat.exe to confirm which Program uses

To confirm all current ports in use, open the command prompt and type this command: netstat -ano -p tcp

The-Netstat-Command-in-Windows

2. Check the below image for the Active Connections. Showing the Protocol, Local Address & Port, State and the Process Identifier (PID). Confirm the Port and look for the corresponding PID for the specific port.

In the next step I will show you how to locate a specific program or process very easily.

Active-Connections-on-Ports

Matching the Process ID

3. When a specific port is in use by a program, another program will be prevented from using the same port. Sometimes it may be difficult to quickly locate the PID.

Using this command which will help to match the process ID:

netstat -ano -p tcp |find "port number"
The-Command-to-find-PID

Please see Task Kill Vs Stop Process: How to forcefully kill or stop a process in Windows, and

Querying the Tasklist

4. The Process above has a PID 8004 listening on TCP port 3307. Use this command to query task list and find the process: tasklist |find “PID”. When you check the image below it shows that a MySQL program or process is currently using the port . This can be confirmed on the task manager.

The-task-List-Command

Also, see How to change the default RDP port in Windows,. How to Allow a blocked app: Application blocked unable to run and apply settings, and how to save netstat command output to a text.

Linux Netstat Command

5. You can do the same task above on a linux system by using this command:

sudo netstat -ano -p tcp. 

You will see all the Nodes or Ports and the corresponding PID.

The-Netstat-Command-in-Linux

I hope you found this blog post Interesting and helpful on how to use Netstat.exe to confirm which Program uses or blocks a port. If you have any questions do not hesitate to ask in the comment section.

Subscribe
Notify of
guest

0 Comments
Inline Feedbacks
View all comments
0
Would love your thoughts, please comment.x
()
x