How to Kill Process on Port?

Ports are used by applications to send and receive data from and to their servers. Every application uses a specific set of ports to communicate and these ports are either automatically or manually opened when the application is installed. In this article, we will discuss the methods to terminate a process related to a port. Since all applications use a specific port, we can ask the operating system to terminate the process that is using a specific port.

How to Kill a Process on Port

How to Kill Process on Port?

Applications that are communicating on a specific port can easily be terminated by instructing the computer to do so. This process, however, differs on operating systems and requires administrative privileges. Also, make sure that there isn’t any other application that is using the port. Below the method to kill a process from its port number is listed below, since the method differs on operating systems, we have listed the methods for some of the most popular ones.

Kill Process on Port in Mac and Linux

  1. Open the terminal and make sure you are signed in as the root user.
    opening the terminal
  2. List the processes that are listening on a specific port by typing in the following command and executing it.
    lsof -i:(port number)
  3. In order to terminate any process that is using the port number to communicate, type in the following command and execute it.
    kill $(lsof -t -i:"Port Number")
  4. The above command might not work on high privilege applications, therefore, execute the following command to immediately terminate any process communicating at a specific port.
    kill -9 $(lsof -t -i:"Port Number")
  5. This command will immediately terminate any process communicating through the specified port number.

Kill Process on Port in Windows

  1. Press “Windows” + “R” to open Run prompt.
  2. Type in “cmd” and press “Shift” + “Ctrl” + “Enter” to open in administrative mode.
    Typing cmd in the Run Prompt and pressing “Shift”+ “Ctrl” + “Enter”
  3. Type in the following command to list the process communicating on a specific port.
    netstat -ano | findstr :<yourPortNumber>
    Typing in the command
  4. This will list the process running on a specific port, note the “PID” for the program.
  5. In order to kill all the processes using the specific port, type in the following command and press “Enter” to execute it.
    taskkill /PID <typeyourPIDhere> /F
  6. This will immediately terminate the program.
Kevin Arrows
Kevin is a dynamic and self-motivated information technology professional, with a Thorough knowledge of all facets pertaining to network infrastructure design, implementation and administration. Superior record of delivering simultaneous large-scale mission critical projects on time and under budget.

Expert Tip

How to Kill Process on Port?

If the issue is with your Computer or a Laptop you should try using Restoro which can scan the repositories and replace corrupt and missing files. This works in most cases, where the issue is originated due to a system corruption. You can download Restoro by clicking the Download button below.

Download Now

I'm not interested