5

I am trying to kill processes on port 6006. However, I seem to be unable to use many of the recommended methods to do so. For example:

sh-4.2$ kill -9 $(sudo lsof -t -i:6006)

Does not work, throwing the error:

kill: usage: kill [-s sigspec | -n signum | -sigspec] pid | jobspec ... or kill -l [sigspec]

If it helps, this is the system I am using:

sh-4.2$  cat /etc/os-release
NAME="Amazon Linux AMI"
VERSION="2018.03"
ID="amzn"
ID_LIKE="rhel fedora"
VERSION_ID="2018.03"
PRETTY_NAME="Amazon Linux AMI 2018.03"
ANSI_COLOR="0;33"
CPE_NAME="cpe:/o:amazon:linux:2018.03:ga"
HOME_URL="http://aws.amazon.com/amazon-linux-ami/"
Joseph Konan
  • 666
  • 2
  • 8
  • 18
  • Note: `kill -9` is a bad habit. Don't use it except when there is no other choice. (after trying `KILL -TERM` and/or `kill -QUIT`) – wildplasser Feb 24 '20 at 20:51

2 Answers2

6

You can try this one line to kill the port

kill -9 $(lsof -t -i:3000 -sTCP:LISTEN)

Reference : https://stackoverflow.com/a/41791637/7697921

Diluk Angelo
  • 1,503
  • 11
  • 21
0

it seems like your kill command usage is not correct. Refer the below stack over flow answer

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