How to Kill a Process Running on Specific Port in Linux?

First, we will need to identify the Process ID that runs on any port. Once we find the Process ID, we can kill it using the kill command using PID.

Kill Process Running on Specific Port

The command given below will kill the process running on Port 3306 – 

# sudo kill -9 $(sudo lsof -t -i:3306)

Here, sudo lsof -t -i:3306 will give the PID of the running process on Port 3306.

# lsof -t -i:3306
2122

As per the above result, 2122 is the PID of the processes running on port 3306. Therefore, we can kill it using the below command – 

# sudo kill -9 2122 



Was this answer helpful?

« Back

chat