How to Enable Dark mode in dbeaver | Step-by-Step Guide ?
You may encounter errors such as "port is currently in use..." and be unable to reassign the same port to another application. As a result, you may need to determine which processes and applications are using that port. So, in this tutorial in our tech room, I'll walk you through the steps to determine the port's process.
This guide will also cover the fundamental concepts of program, process, and port, as well as how they interact with one another. Then we'll show you how to find out what process the port is using in Windows, Mac, and Linux. Doesn't that sound fantastic? Let's get this party started right away.
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 anything like MS Word, Google Chrome tab, small background task. Process 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 TO THE SAME SOCKET ie( IP ADDRESS: PORT COMBINATION ). If you open two notepads, then you will find two separate processes in the task manager each using a separate port.
Netstat is a useful command-line scripting utility available for 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
Here,
-a | Helps to display all the active ports. |
-b | Helps to display the executable file of listening ports. |
-o | Helps to display the process identifier(PID) associated 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 another. Here, the output of netstat -ano is the input to findstr |
findStr | Helps to find the 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 the Process / Program with the help of PID because PID is associated 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 associated with it.
Here, The tasklist cmdlet allows us to retrieve a list of all currently running processes./FI is a filter that helps in the finding of matches defined by the filter. In this case, the 'eq' filter on PID is used. You can also use other filters like eq, ne, gt, lt, ge, le, and so on. Also, the PID number must be positive.
You can simply type the below command:
For TCP:
For UDP:
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.
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 features. In the list, it provides process name, processId, Protocol, State, local address, local port, 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.
1 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.
2 Then you will get the process name and module name as shown above.
This shows that the 1434 port is used by MSSQL Server.
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.
eg. netstat -tulpn | grep : 3030
This will find out the process using 3030 PID.
In the CentOS version, you could try like below:
Find Process/program using Port in MacOs using Netstat Command
eg. netstat -vanp tcp | grep 3030
Find Process/Program using Port in For macOS El Capitan and newer using the below command will work.
eg. lsof -i tcp:3030
see man lsof for detail
Using Activity Monitor
This tool is a built-in tool that helps you to view all the processes that are running on your Mac Computer.
Steps to view the process using Activity Monitor:
There are also other tools like TCPView and Little Snitch.