Find which service / program is running on a port Ubuntu

To find out which service or program is running on particular port in Ubuntu / Linux you can run the following command:

sudo lsof -i :port_number

This command will return the process ID (PID).

You can then stop this service / program by running:

sudo kill PID