Let’s start the discussion about How to kill a process on a specific port in following methods.
When working with Linux, we frequently need to stop a process that utilises a specific port. In this article, we’ll go through how to identify a process based on the port it uses and how to kill it.
Contents
How to kill a process on a specific port
To list any process listening to the port 8054 use:
lsof -i:8080
To kill any process listening to the port 8054 use:
kill $(lsof -t -i:8054)
or
kill -9 $(lsof -t -i:8080)
To kill a process on port in windows :
$ netstat -ano | findstr "PORT_NUMBER"
$ taskkill /PID PORT_NUMBER /f
I hope the strategies listed above work for you. Happy coding and come back again.
Similar Post : How to kill Specific process on port