Run the command “netstat -ab” in an elevated Command Prompt, PowerShell, or Terminal window to display a list of applications and their associated ports.
Whenever an application wants to make itself accessible over the network, it claims a TCP/IP port, which means that port can’t be used by anything else. So how do you check open ports to see what application is already using it?
Update: We’ve tested this process and confirmed that all of the steps are up-to-date, and that they all work in Windows 11, too.
How Do Ports Work?
An IP address specifies a computer — or other network device — on a network. When one device sends traffic to another, the IP address is used to route that traffic to the appropriate place. Once the traffic reaches the right place, the device needs to know which app or service to send the traffic on to. That’s where ports come in.
RELATED: How to Forward Ports on Your Router
If the IP address is akin to a street address on a piece of mail, the port is something like the name of the person at that residence who gets the mail. For the most part, you don’t need to worry about ports. But once in a while, you might encounter an app that’s set to listen for traffic on the same port that another app already has in use. In that case, you’ll need to identify the app that already has that port in use.
RELATED: What’s the Difference Between TCP and UDP?
There are a number of ways to tell what application has a port locked, but we’re going to walk you through a couple of built-in ways that use the Command Prompt, PowerShell, or the Terminal, and then show you a great freeware application that makes it even easier. All these methods should work no matter which version of Windows you use.
Use Built-In Tools to See What Is Listening on a Port
We’ve got two commands to show you. The first lists active ports along with the name of the process that’s using them. Most of the time, that command will work fine. Sometimes, though, the process name won’t help you identify what app or service actually has a port tied up. For those times, you’ll need to list active ports along with their process identifier numbers and then look those processes up in Task Manager.
Option One: View Port Use Along with Process Names
First, you’ll need to open the Command Prompt in administrator mode. Hit Start, and then type “command” into the search box. When you see “Command Prompt” appear in the results, right-click it and choose “Run as administrator,” or click “Run as Administrator” on the right.
Note: You can also use PowerShell or Terminal for this.
At the Command Prompt, type the following text and then hit Enter:
After you hit Enter, the results may take a minute or two to fully display, so be patient. Scroll through the list to find the port (which is listed after the colon to the right of the local IP address), and you’ll see the process name listed under that line. If you’d like to make things a little easier, remember that you can also pipe the results of the command to a text file. You could then just search the text file for the port number you’re after.
RELATED: How to Save the Command Prompt’s Output to a Text File in Windows
Here, for example, you can see that port 49902 is tied up by a process named picpick.exe. PicPick is an image editor on our system, so we can assume the port is actually tied up by the process that regularly checks for updates to the app.
Option Two: View Port Use Along with Process Identifiers
If the name of the process for the port number you’re looking up makes it difficult to tell what the related app is, you can try a version of the command that shows process identifiers (PIDs) rather than names. Type the following text at the Command Prompt, and then hit Enter:
The column at the far right lists PIDs, so just find the one that’s bound to the port that you’re trying to troubleshoot.
Next, open up Task Manager by right-clicking any open space on your taskbar and choosing “Task Manager.” You can also hit Ctrl+Shift+Esc.
If you’re using Windows 8, 10, or 11 switch to the “Details” tab in Task Manager.
RELATED: What’s New in the Task Manager in Windows 11’s 2022 Update
In older versions of Windows, you’ll see this information on the “Processes” tab. Sort the list of process by the “PID” column and find the PID associated with the port you’re investigating. You might be able to tell more about what app or service has the port tied up by looking at the “Description” column.
If not, right-click the process and choose “Open file location.” The location of the file will likely give you clues as to what app is involved.
When Once you’re there, you can use the End Process, Open File Location, or Go to Service(s) options to control the process or stop it.
Use NirSoft CurrPorts to View What is Listening on a Port
If you aren’t really the Command Prompt type — or you’d rather just use a simple utility to do all this in one step — we recommend the excellent freeware CurrPorts utility by NirSoft. Go ahead and download the tool. Just make sure you get the right version (the regular version is for 32-bit Windows and the x64 version is for 64-bit Windows). It’s a portable app, so you won’t need to install it. Just unzip the download folder and run executable.
RELATED: How Do I Know if I’m Running 32-bit or 64-bit Windows?
In the CurrPorts window, sort by the “Local Port” column, find the port you’re investigating, and you can see everything — the process name, PID, port, the full path to the process, and so on.
To make it even easier, double-click on any process to see every single detail in one window.
When you’ve determined what app or service has the port you’re investigating tied up, it’s up to you how to handle it. If it’s an app, you may have the option to specify a different port number. If it’s a service — or you don’t have the option to specify a different port number — you’ll likely have to stop the service or remove the app.
RELATED: Understanding and Managing Windows Services
Source by www.howtogeek.com