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

First of all, we will need to identify the Process ID which 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 :

Below command 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 running process on Port 3306.

# lsof -t -i:3306
2122

Now, as per the above result 2122 is the PID of the processes running on port 3306. We can kill it using below command.

# sudo kill -9 2122

 

Related Articles

How to parse PHP in html files?

Are you looking to make all the .html pages of your websites to run as .php or you are looking to...

How to List All Files Ordered by Size in Linux?

In Linux, we can list all the files using the ls command. Here, we will share some commands which...

How to take Backup of Exim Configuration from WHM?

EXIM comes with cPanel which is responsible for the email tranfer on the Linux server. Users can...

How to Disable SELinux on CentOS?

SELinux called Security-Enhanced Linux is a security module of Linux kernel which provides...

How to check Various cPanel logs like WHM, Apache, MySQL, Email, Error etc?

You can use cPanel to access your Linux hosting account with GUI. It is relatively easier to work...

  • 0 Users Found This Useful

Was this answer helpful?