How to kill the application consume the specific port in Ubuntu

When I doing the troubleshooting work, I always find handy to kill the application that running on a specific port.

As a Developer, you are quite familiar with your application. you understand the running port and the application name. But sometime an application name is not unique in a operating system or a container.

You may end up with multiple processes with the same name, and you don’t know which process to kill.

In this case, you want to kill the application that consume that port. For example, if you are certain that your application is running on port 8000, you can use the following command to kill it.

sudo fuser -k 8000/tcp