If a port is being used by ubuntu/Linux and you want to kill the process and make free that port, then simple you can run this command to make that port free

sudo kill `sudo lsof -t -i:9001`

If that doesn’t work you could also use $() for command interpolation:

sudo kill $(sudo lsof -t -i:9001)


To View the list of curretly used port you can run the following command

netstate -lntu