Linux Find Out Which Process Is Listening Upon a Port

In Linux, you can use the lsof (List Open Files) command to find out which process is listening upon a specific port.

Here’s an example of using lsof to find the process listening on port 80:

lsof -i :80

This command will display a list of all the open files on the system, with the associated process ID (PID) and program name. The -i option is used to specify that you want to see information about Internet sockets, and the :80 specifies the port number (in this case, port 80).

The output will show the PID, program name, and user that is associated with the process listening on the specified port. For example:

COMMAND PID USER FD TYPE DEVICE SIZE/OFF NODE NAME
nginx 1234 root 4u IPv4 123456 0t0 TCP *:80 (LISTEN)

In this example, the process with PID 1234 is an instance of the nginx program and is listening on port 80.

Leave a Comment