If you’re a system administrator, you know how important it is to keep an eye on the processes running on your Windows system. Sometimes, you may need to find out which process is listening on a particular port. In this article, we’ll show you how to do that using both CMD and PowerShell.

Advertisement

By learning how to identify the process listening on a port, you can troubleshoot network-related issues more effectively and take necessary actions to fix them.

Method 1. Using Command Prompt

Use the following command to find out the process id (PID) listening on port 80. You can change this port to search for another port.

netstat -aon | findstr ":80" | findstr "LISTENING" 
Output:
TCP 0.0.0.0:80 0.0.0.0:0 LISTENING 4 TCP [::]:80 [::]:0 LISTENING 4

The output will show you the process ID (PID) of the process listening on the specified port. You can then use the Task Manager to find the process using the PID.

Use this process id with the task list command to find the process name.

tasklist /fi "pid eq 4" 

You will see the process name in the results.

Which Process is Listening on a Port in Windows
Finding the process listening on specific port in Windows

Method 2. Using PowerShell

The second method uses the PowerShell command to find out the process running on a specific port on Windows.

Launch the PowerShell terminal and execute the following command to find the process name running on port 80. You can change the port number to check for other ports.

Get-Process -Id (Get-NetTCPConnection -LocalPort 80).OwningProcess 

The output will show you the process ID (PID) of the process listening on the specified port. You can then use the Task Manager to find the process using the PID.

Checking the process name running on specific port

Conclusion

In conclusion, identifying the process listening on a port is a useful skill for system administrators, especially when troubleshooting network-related issues. In this article, we’ve shown you how to do that using both CMD and PowerShell.

By using CMD, you can use the netstat command to find out which process is listening on a port. In PowerShell, you can use the Get-NetTCPConnection cmdlet to achieve the same result.

With these tools at your disposal, you can quickly identify the processes that are listening on specific ports on your Windows system and take necessary actions to fix any issues that may arise. So, next time you need to troubleshoot network-related issues, try using CMD or PowerShell to identify the processes listening on specific ports, and see how it can make your job easier.

Share.

1 Comment

Leave A Reply


Exit mobile version