≡ Menu

How to list all processes listening on a port on Linux?

The question is – I need to know which processes are listening on port 80 on my Linux CentOS box. Is there a Linux command that can help me find this information?

Yes! There are two commands, one is called netstat which is now deprecated in favor of a command called ss. Both have almost the same syntax and command line arguments. In this tutorial, I will show you how to list the processes listening on port 80 (HTTP) and port 22 (SSH). You can just change the command by a bit and list processes listening on any port!

To find out which processes are listening on port 80, use the following command:

ss -plant | grep :80
OR
netstat -plant | grep :80

This will output something like the following:

LISTEN  0  0  *:80 *:* users:(("httpd",30569,3),("httpd",30571,3))

This output shows that httpd is listening on port 80. The process httpd is Apache’s HTTP daemon. It listens on the HTTP port 80 and serves your web pages over HTTP.

To check on which processes are listening on port 22 (The SSH port), use the following command:

ss -plant | grep :22

This will output something like the following:

LISTEN 0 0  *:22  *:* users:(("sshd",1419,3))

By changing the port after the colon in the grep command, you can find out which processes are listening on any port on your Linux / Unix box!

{ 0 comments… add one }

Leave a Comment