Skip to content

Archive for

5
Aug

Check if a service is running on a specific port

Let’s say we want to see if our http server (apache or nginx) is running on port 80, on our machine. For this task we will use netstat command:

netstat -tulpn | grep :80

you will get:

tcp        0      0 0.0.0.0:80                  0.0.0.0:*                   LISTEN      1336/httpd
tcp        0      0 :::80                       :::*                        LISTEN      1336/httpd

To check if FTP service is running run:

netstat -tulpn | grep :21

You will get:

tcp        0      0 0.0.0.0:25                  0.0.0.0:*                   LISTEN      1612/exim
tcp        0      0 :::25                       :::*                        LISTEN      1612/exim

To check if our mail server is running:

netstat -tulpn | grep :25

You will get:

tcp        0      0 0.0.0.0:21                  0.0.0.0:*                   LISTEN      1649/pure-ftpd (SER
tcp        0      0 :::21                       :::*                        LISTEN      1649/pure-ftpd