Sometimes you may get issues like "port is currently in use ... " and then cannot reassign the same port to another application. So, you may have to find which process and application is using that port. So, in this tutorial in ourtechroom, I'll walk you through steps to find out the process used by the port.
In this guide, you'll also provide core concepts of program, process, and port and how they work with each other. And after that, will provide you how to find out the process used by the port in Windows, Mac, and Linux. Sounds awesome? Let's get started right now.
Process and Port are different things. A program or application is a piece of information that does specific things and is stored in some physical storage. When the program is loaded into memory then the process comes into existence. The process is a program that is currently running on your computer. The process can be anythings like MSword, Google Chrome tab, small background task. Proces in a computer system is identified by a certain number called a PID number. This PID tag is used by the operating system to identify each process.
A port is the endpoint of communication. If you open two tabs in your chrome browser you will find different processes running on different port numbers. This process Id and port number identify which port that process is using to communicate.
Within the same network(local or remote),No two applications can listen to the same port at the same.ie.NO TWO PROGRAMS CAN respond THE SAME SOCKET ie( IP ADDRESS: PORT COMBINATION ). If you open two notepads, then you will find two separate processes in task manager and each using the separate port.
Find process/program using Port in Windows Using Command Prompt
Netstat is a useful command-line scripting utility available for both Windows, Mac, Linux, and Unix. Netstat helps to show network statistics and connections of your system. and is taken as a powerful networking tool for troubleshooting and network configuration. With the help of the netstat command, we can easily find out the process using the port.
In Windows OS just find a port number and apply the following command in the command prompt
|-a||Helps to display all the active ports.|
|-b||Helps to display the executable file of listening ports.|
|-o||Helps to display process identifier(PID) associate with each connection.|
|-n||Helps to display port and address in numeric format.|
||||Called a Pipe which is used to combine two or more commands. Here, the output of one command is input to other. Here, the output of netstat -ano is the input to findstr|
|findStr||Helps to find string present left to it.|
|port_number||Any port whose process you want to find.|
Here, I am going to find out the process used by port number:1434 as below.
This will give information like which protocol is used either TCP or UDP, which local address and port are used, which remote address and port are used, what is the current state of the process, PID number of the process/program using the port, etc.
Now, we can scan Process / Program with the help of PID because PID is associate with the process. Let's find Process/Program using the given port by following the command.
Here, we have 5720 PID, and let's find the process associate with it.
Find process/program using Port in Windows Using Powershell
You can simply type the below command:
Find process/program using the port in Windows using Resource Manager
Resource Monitor is a powerful GUI tool available for windows 7/8/10/11 for finding out how much hardware resources(disk, network, memory, and CPU)and software resources are being used by the process in real-time.
- Goto run and type "resmon.exe" without quote and press enter.
- Under Overview, you will find the process name as Image, PID, Description, Status, and many more.
Find Process/program using the port in Windows using third-party Tools
There are lots of third-party tools which help to easily find out the process/program using the port. Some of them are TCPView.Here I will explain to you how to use TCPView to find processes using the port.
TCPView is a third-party network monitoring windows application that provides detailed information of all TCP and UDP endpoints on a system.
1. First, install TCPView from here.
2. Open TCPView and its interface look as below:
It is easy to use because of its better UI and UX feature. In the list, it provides process name, processId, Protocol, State, LocalAddress, LocalPort, Remote Address, Process Created Time, Module Name, Sends packet and receives a packet by the process and its size, etc. You can search for anything from the free text search field located in the middle of the application
Check Process Name / Program using TCPView.
In Search bar type port number. In my case, I am searching process name or program name using port 1434 so I used 1434 in the search field.
Then you will get the process name and module name as shown above.
This shows that the 1434 port is used by MSSQL Server.
Find process/program using Port in Linux Using Netstat Command
You can simply use netstat command to find out the program using the port in Linux. We can do it by typing the below command in the terminal.