Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

shell script to kill the process listening on port 3000? [duplicate]

I want to define a bash alias named kill3000 to automate the following task:

$ lsof -i:3000  COMMAND   PID USER   FD   TYPE  DEVICE SIZE/OFF NODE NAME ruby    13402 zero    4u  IPv4 2847851      0t0  TCP *:3000 (LISTEN)  $ kill -9 13402 
like image 545
Jonathan Avatar asked Feb 06 '12 22:02

Jonathan


People also ask

How do you kill a process in Shell?

There are two commands used to kill a process: kill – Kill a process by ID. killall – Kill a process by name.


1 Answers

alias kill3000="fuser -k -n tcp 3000" 
like image 59
SamB Avatar answered Sep 22 '22 08:09

SamB