При запуске новых сервисов в Windows, вы можете обнаружить что нужный порт уже занят (слушается) другой программой (процессом). Разберемся, как определить какая программ прослушивает определенный TCP или UDP порт в Windows.
Например, вы не можете запустить сайт IIS на стандартном 80 порту в Windows, т.к. этот порт сейчас занят (при запуске нескольких сайтов в IIS вы можете запускать их на одном или на разных портах). Как найти службу или процесс, который занял этот порт и завершить его?
Чтобы вывести полный список TCP и UDP портов, которые прослушиваются вашим компьютером, выполните команду:
netstat -aon| find "LIST"
Или вы можете сразу указать искомый номер порта:
netstat -aon | findstr ":80" | findstr "LISTENING"
Используемые параметры команды netstat:
- a – показывать сетевые подключения и открытые порты
- o – выводить идентфикатор професса (PID) для каждого подключения
- n – показывать адреса и номера портов в числовом форматер
По выводу данной команды вы можете определить, что 80 порт TCP прослушивается (статус
LISTENING
) процессом с PID 16124.
Вы можете определить исполняемый exe файл процесса с этим PID с помощью Task Manager или с помощью команды:
tasklist /FI "PID eq 16124"
Можно заменить все указанные выше команды одной:
for /f "tokens=5" %a in ('netstat -aon ^| findstr :80') do tasklist /FI "PID eq %a"
С помощью однострочной PowerShell команды можно сразу получить имя процесса, который прослушивает:
- TCP порт:
Get-Process -Id (Get-NetTCPConnection -LocalPort 80).OwningProcess
- UDP порт:
Get-Process -Id (Get-NetUDPEndpoint -LocalPort 53).OwningProcess
Можно сразу завершить этот процесс, отправив результаты через pipe в командлет Stop-Process:
Get-Process -Id (Get-NetTCPConnection -LocalPort 80).OwningProcess| Stop-Process
Проверьте, что порт 80 теперь свободен:
Test-NetConnection localhost -port 80
Чтобы быстрой найти путь к исполняемому файлу процесса в Windows, используйте команды:
cd /
dir tiny.exe /s /p
Или можно для поиска файла использовать встроенную команду where :
where /R C:\ tiny
В нашем случае мы нашли, что исполняемый файл
tiny.exe
(легкий HTTP сервер), который слушает 80 порт, находится в каталоге c:\Temp\tinyweb\tinyweb-1-94
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.
Take Control with cPanel
Manage every aspect of your website with our intuitive cPanel. From email setup to file management, enjoy complete control. Experience reliable hosting with robust features.
Explore cPanel Plans
Related Blogs:
Find Process ID of Process using given port in Windows
Once a while it happens that you try to start Tomcat and it complains “Port 8080 required by Tomcat v7.0 Server at localhost is already in use”. So that means there is already a process running in background that has occupied 8080 port. So how to identify the process in Windows task manager that is using port 8080? I am sure there must be a javaw.exe
. But is there a better way to identify which process in windows is using a given port number? Yes…
How to Find Process ID of process that uses a Port in Windows
Our friend netstat
will help us in identifying the process. netstat can list the running process and display information such as process id, port, etc. From this list we can filter the processes that has given port using findstr
command.
List process by port number
Code language: Bash (bash)
netstat -ano | findstr 8080
Output
Code language: Bash (bash)
Proto Local Address Foreign Address State PID TCP 0.0.0.0:8080 0.0.0.0:0 LISTENING 29848
-a
– Displays all connections and listening ports.-o
– Displays the owning process ID associated with each connection.-n
– Displays addresses and port numbers in numerical form.
We can use netstat
to list all the processes.
List all processes by PID
Code language: Bash (bash)
netstat -ano
Kill the Process by PID
Once we identify the process PID, we can kill the process with taskkill
command.
Code language: Bash (bash)
taskkill /F /PID 12345
Where /F
specifies to forcefully terminate the process(es). Note that you may need an extra permission (run from admin) to kill some certain processes.
Or else you can use our old trusted Windows Task Manager to kill the process for given process id. If PID is not visible in your task manager then you can enable it by Right clicking on table header under Details tab, click Select Columns and then check PID.
How to Identify Programs Using or Blocking Ports on Your Computer
Windows:
The Netstat.exe utility has a switch that can display the process identifier (ID) associated with each connection to identify port conflicts. This information can be used to determine which process (program) listens on a given port.
Using Netstat command:
- Open a CMD prompt
- Type in the command: netstat -ano -p tcp
- You’ll get an output similar to this one
- Look out for the TCP port in the Local Address list and note the corresponding PID number
Using Task Manager, you can match the process ID listed to a process name (program). This feature enables you to find the specific port that a program currently uses. Because this specific port is already in use by a program, another program is prevented from using that same port.
To Match the Process ID to a Program Using Task Manager:
- Press CTRL+ALT+DELETE, and then click Task Manager.
- Click the Processes tab.
- If you do not have a PID column, click View, click Select Columns, and then click to select the PID (Process Identifier) check box.
- Click the column header labeled «PID» to sort the process by their PIDs. You should be able to quickly find the process ID and match it to the program listed in Task Manager.
To Match the Process ID to a Program Using the Command Line:
Example to find which process uses TCP port 9443:
C:\>netstat -ano -p tcp |find «9443»
Process with PID 1400 is listening on TCP port 9443. Now, we can query the task list to find the process.
C:\>tasklist |find «1400»
Here is a typical situation where the EveryonePrint Web service uses TCP port 9443.
Linux:
The Netstat.exe command has a switch that can display the process identifier (PID) associated with each connection to identify port conflicts. This information can be used to determine which process (program) listens on a given port.
Using Netstat command:
- Open a terminal
- Type in the command: sudo netstat -ano -p tcp
- You’ll get an output similar to this one
- Look out for the TCP port in the Local Address list and note the corresponding PID number
To Match the Process ID to a Program:
From the netstat list, you already know the Program name; you can have further details about it using the following command:
ps -ef | grep <PID number>
Last Updated :
09 Apr, 2025
Open ports on your Windows computer act like doors for data-letting information in and out. While necessary for apps and services, unprotected ports can become security risks. Checking which ports are open helps you spot vulnerabilities, fix connection issues, and keep your system safe.
Using Command Prompt (CMD), you can quickly see active ports with simple built-in commands—no extra tools needed. This guide walks you through the steps to check open ports in Windows, understand the results, and close any unnecessary ones.
Whether you’re troubleshooting a network problem or guarding against threats, these CMD techniques give you control over your system’s security.
How to Check Open Ports Using CMD in Windows
Make sure that the essential ports are allowed or blocked by your firewall system configuration. The Control Panel’s Windows Firewall settings allow you to control all the initial processes for system requirements. If you discover the open ports that ought to be closed within the system, you might want to halt the related service or change the in-build configuration of the program that opened the port manually.
Now, see the below-mentioned steps and implement them to Check Open Ports Using CMD in Windows.
Step 1: Open CMD or Command Prompt
- Press Win + R from your keyboard > Type cmd > Click on the Enter button
Step 2: Implement the «netstat» Command
An effective tool for keeping an eye on open ports within the system and configured network connections is the netstat command to simplify. It offers comprehensive details on all open connections and system servers, such as the protocol in use, and local and international addresses to control or verify all the connection’s status.
- Type the below command in the cmd to check the open port functions > Press Enter
netstat -an | find "LISTEN"
- See the output below
TCP 0.0.0.0:135 0.0.0.0:0 LISTENING
TCP 0.0.0.0:445 0.0.0.0:0 LISTENING
TCP 0.0.0.0:902 0.0.0.0:0 LISTENING
In this case, 0.0.0.0 designates that all pre-processed network interfaces are listening on the port, which is open for the internal system server. The port number is the number that comes after the colon of the system commands (e.g., 135, 445, 3389).
Step 3: Observe the functional Process Using the Port
- Write the following command to identify which application or process is using a specific port within the system.
netstat -ano | find "LISTEN"
An extra -o flag is included with this command while processed, which shows the Process ID (PID) connected to each port manually.
- See the output within a PID column
TCP 0.0.0.0:135 0.0.0.0:0 LISTENING 1160
TCP 0.0.0.0:445 0.0.0.0:0 LISTENING 4
- Search and Open Task Manager > Go to Details option > See the PID column
Step 4: Check Specific Port in cmd
- You can change the implemented command to focus on a particular port if you want to see if it’s open or not within the system configuration. For instance, use this to see if port 60 is open to identify the process:
netstat -an | find ":60"
- See the final entry below —
TCP 0.0.0.0:40 0.0.0.0:0 LISTENING
Conclusion
Using Windows’ CMD to check all the internal open ports is a simple yet effective method for network management, security control, and troubleshooting issues identification. You can safeguard your system from external potential dangers and make sure your connected network is operating efficiently by routinely checking open ports within the system. The netstat command is an invaluable resource for any IT professional or developer toolset, especially when paired with a basic understanding of ports and processes of all the initial implementations.
Also Read
- How to check Active Network Connections in Windows?
- Ways to Find Out List of All Open Ports in Linux