While using a Linux system, you may occasionally encounter a port conflict when starting a service, which prevents the service from launching.
So how can you check which service is occupying a specific port?
You can use the following command:
lsof -i:22

As shown above, using port 22 as an example, we can see it is occupied by the SSH service.
To query a different port, simply replace the port number in the command above.