kill process at a port ubuntu

C++
sudo kill -9 `sudo lsof -t -i:9001`sudo kill -9 `sudo lsof -t -i:3002`sudo kill -9 `sudo lsof -t -i:{PORT_NUMBER}`sudo kill -9 $(sudo lsof -t -i:9001)

Source

Also in C++: