How to find which process/program using the port in Windows, Mac and Linux ?

👤 Diwas Poudel    🕒 10 Sep 2023    📁 FIX

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 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.

Also read: Computer | Laptop Ports and Their Functions Explained

Windows Environment

Find process/program using Port in Windows Using Command Prompt

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

netstat -ano | findstr


-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.
Also read: What is localhost:8080?

Here, I am going to find out the process used by port number:1434 as below.

fig. finding processid (PID)

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.

tasklist /FI "PID eq  5720"

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.

fig. Find Process / Program using PID Number

Find process/program using Port in Windows Using Powershell 

You can simply type the below command:

For TCP:

Get-Process -Id (Get-NetTCPConnection -LocalPort ).OwningProcess
  • Get-Process is a Powershell cmdlet that returns all background processes that are currently running in Windows.
  • Get-NetTCPConnection cmdlet helps to get current TCP connections.
  • -LocalPort helps to find current TCP connections having a local port.

For UDP:

Get-Process -Id (Get-NetUDPEndpoint -LocalPort ).OwningProcess

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.

  1. Goto run and type "resmon.exe" without quote and press enter.
  2. Under Overview, you will find the process name as Image, PID, Description, Status, and many more.
Fig showing process using resmon.exe program

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:

tcpview-networkmonitoring-application.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.

Also Read: Difference between Post 80 and Port 8080

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.

fig. search port in TCPView

Then you will get the process name and module name as shown above.

This shows that the 1434 port is used by MSSQL Server.

Linux Environment

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.

netstat -tulpn | grep :

eg. netstat -tulpn | grep : 3030

This will find out the process using 3030 PID.

In the CentOS version, you could try like below:

netstat -vanp --tcp | grep 3030

macOS Environment

Find Process/program using Port in MacOs using Netstat Command

 netstat -vanp tcp | grep

eg. netstat -vanp tcp | grep 3030

Find Process/Program using Port in For macOS El Capitan and newer using the below command will work.

 lsof -i tcp:

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:

  1. First of all open Activity Monitor tools
  2. Then click on the Network Tab.
  3. Then look for the process (under the "Name" column) that is using the port you are interested in. 

There are also other tools like TCPView and Little Snitch.