If you’ve faced a blocked or in-use port, it can be frustrating. Fortunately, there are easy ways for Windows and Linux users to find which program or process is using a port and resolve conflicts.
In this guide, we’ll walk you through how to find the program or process that’s using a particular port on both Windows and Linux systems, and I’ll also show you the tools available to resolve port conflicts.
Why Knowing Which Process Uses a Port is Important?
Ports are essential for network communication, and multiple programs might attempt to use the same port, leading to conflicts. By finding which process is using a specific port, you can avoid these conflicts, ensure smooth network operations, and troubleshoot issues that arise from port usage.
Method 1: Using Command Prompt (Windows)
The Netstat utility on Windows can help you find which application is using a specific port. Here’s how you can use this method to track down which process is occupying a particular port:
Press the Windows key, type CMD in the search box, right-click on Command Prompt, and select Run as Administrator. Then enter the command:
netstat -aon -p tcp
This command will display a list of all TCP connections, their local addresses, the process IDs (PIDs), and the state of each connection.
Look through the list for the port you’re concerned about (e.g., port 135 in the above screenshot).
Find the PID number associated with that port in the last column. i.e; 1436 there.
To match the PID with the program name, use the following command in the same Command Prompt window:
tasklist | find "PID_number"
For example, if the PID number from the previous command was 1400, you would run: tasklist | find “1436”
This will show you the name of the application using that port (e.g., FileZilla Server, SQL Server, etc.).
Method 2: Using Resource Monitor (Windows)
If you prefer a more visual approach, Windows’ Resource Monitor tool can provide a detailed view of the programs using specific ports.
- Press the Windows key and type resource monitor or resmon in the search box. Click on Resource Monitor to open the tool.
- In Resource Monitor, navigate to the Network tab.
In the Listening Ports section, you’ll see a list of all open ports and the applications that are using them.
You can check the PID column to match the process IDs with the applications.
Method 3: Command Line on Linux
If you’re using Linux, the process is quite similar, but instead of Command Prompt, you’ll use the Terminal to run the necessary commands.
- Open a terminal on your Linux machine.
- Enter the following NetStat command to get a list of active connections:
sudo netstat -ano -p tcp
This will show all TCP connections with their corresponding PIDs.
Similar to Windows, locate the specific port number and note the associated PID.
Once you have the PID, you can use the following command to find more details about the process:
ps -ef | grep
This will display the program name and other details related to the process ID.
Additional Tips:
How to Interpret the netstat Command:
You can customize the netstat command with different flags to refine the results:
-a | Displays all active connections and listening ports. |
-n | Shows addresses and port numbers in numerical form (instead of resolving them to hostnames). |
-o | Displays the PID associated with each connection. |
-p | Displays the protocol (TCP, UDP, etc.). |
Task Manager PID Column:
If you’re using Windows Task Manager to match a PID, ensure the PID column is visible. To do this, click on the View menu, select Select Columns, and check the box for PID (Process Identifier).
Knowing which application is using a port is essential for troubleshooting network and application conflicts. By following the methods above, you can easily find which program or process is using a particular port on both Windows and Linux systems. Whether you prefer using the command line or a graphical interface, there are plenty of ways to resolve port conflicts efficiently.
Related Blogs: