Kill a process running on port x (Ubuntu)

Recently I’ve started running into an annoying issue at work where I try and run a program which happens to already be running, because this program is bound to port X, it won’t start.

Obviously, this shouldn’t be a problem – locate and kill the process, restart the program, job done. And now it’s even simpler since I’ve discovered this lovely one liner;

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

Simply replace 3000 with the port you’re looking for and your sorted!

Read More