Kill process that is taking specific port
NickName:Kunok Ask DateTime:2017-01-07T23:51:28

Kill process that is taking specific port

Is is possible to programatically select process that is taking a specific port (:3000 for example) and kill it ?

I do that by hand now by using

netstat -tp

and then I would check pid of a process and kill it using kill command.

I want to write a shell script that would do that automatically.

Copyright Notice:Content Author:「Kunok」,Reproduced under the CC 4.0 BY-SA copyright license with a link to the original source and this disclaimer.
Link to original article:https://stackoverflow.com/questions/41523255/kill-process-that-is-taking-specific-port

More about “Kill process that is taking specific port” related questions

Kill process that is taking specific port

Is is possible to programatically select process that is taking a specific port (:3000 for example) and kill it ? I do that by hand now by using netstat -tp and then I would check pid of a proce...

Show Detail

One command to kill a process using a specific port

For a project, I constantly need to find the process using a specific port and kill that process. I do this by: lsof -i :portnumber #read the pid kill -9 pid Since I do this a lot, I'm a bit bore...

Show Detail

Is it possible in python to kill process that is listening on specific port, for example 8080?

Is it possible in python to kill a process that is listening on a specific port, say for example 8080? I can do netstat -ltnp | grep 8080 and kill -9 <pid> OR execute a shell command from py...

Show Detail

How to kill a process on a port on ubuntu

I am trying to kill a process in the command line for a specific port in ubuntu. If I run this command I get the port: sudo lsof -t -i:9001 so...now I want to run: sudo kill 'sudo lsof -t -i:90...

Show Detail

kill a process on a specific port by name

I have a process running on port 3200, which communicates with other processes on other ports. I know I can kill a process on a given port by doing kill -9 $(lsof -t -i:3200). My problem is that ...

Show Detail

How to kill a process running on particular port in Linux?

I tried to close the tomcat using ./shutdown.sh from tomcat /bin directory. But found that the server was not closed properly. And thus I was unable to restartMy tomcat is running on port 8080. I ...

Show Detail

Kill multiple process by its port from batch

I want to kill several processes which are listening specific ports (say 2100 and 2101). I can kill a process by its port. But i want to do the same for multiple port(more than one) Batch Code (Wo...

Show Detail

How to kill process on port on Windows when the port cannot be opened?

I'm on a Windows machine. Typically, when I need to kill a process on a port I do the following: netstat -ano | findstr : <PORT> After that command, the Process Identifier (PID) should appear...

Show Detail

Trying to kill process on port 8000 confusion

I am writing a Ruby script that deploys a server on port 8000 in the background, and then in the foreground I issue queries to the server. After I've issued my queries I kill the server, however wh...

Show Detail

Kill a server listening on specific port

i am executing this php file to stop my server from listening mode command: echo exec('npx kill-port 9005'); it display this message on screen: Process on port 9005 killed but when i open xampp port

Show Detail