find what is using a port on linux
To find which process is using a port on Linux, run:
sudo ss -lptn 'sport = :8080'
Replace 8080 with the port you want to inspect.
You can also use:
sudo lsof -i :8080
Useful when a service refuses to start because its port is already occupied.