For a project, I constantly need to find the process using a specific port and kill that process. I do this by:
lsof -i :portnumber
#read the pid
kill -9 pid
Since I do this a lot, I'm a bit bored to do so. So, I wonder if there is a way to kill a process using a specific port with only one command? If not, is there a python command that returns the pid of the process using a specific port, so that I can write a simple script to make the work?