How to find out what service is using a certain port?

To find out which service or program using a port on a Linux machine, you can use the command

Example

In this case, TCP port 80 is used by a process with PID 1144, that is Nginx. This process has multiple subprocesses with PID 1145, 1146, 1147, and 1148.

You can also use

This just lists all process IDs. You can find the process by looking at the result of “ps aux” command and finding the process with the above process ids.

Using netstat

Another method is to use “netstat -lntp” command

This lists all listening ports. The last column shows PID/Program name. To find a specific port, you can use grep

In the above command, we find which program uses port 80.

Leave a Reply

Your email address will not be published. Required fields are marked *