I always want to kill a process id which listening on Port 3000. So presently I am using,
1.lsof -i tcp:3000
will give output as,
COMMAND PID USER FD TYPE DEVICE SIZE/OFF NODE NAME ruby 6697 xxxx 5u IPv4 251982 0t0 TCP *:3000 (LISTEN)
and I will kill the PID using,
kill -9 6697
I want to create a bash program which do this process automatically.
I tried using xargs to get PID of the output of first command but failed.