Skip to end of metadata
Go to start of metadata

To check listening port on CentOS 7, you can do it by "netstat" simply, or you can try it by "ss". I was easily able to check which port is open or not on CentOS 7.


# netstat -tulnp

The above shows its result like below:

# netstat -tulnp
Active Internet connections (only servers)
Proto Recv-Q Send-Q Local Address           Foreign Address         State       PID/Program name
tcp        0      0 0.0.0.0:25              0.0.0.0:*               LISTEN      2755/master
tcp        0      0 127.0.0.1:6379          0.0.0.0:*               LISTEN      2104/redis-server 1
tcp        0      0 0.0.0.0:11211           0.0.0.0:*               LISTEN      2086/memcached
tcp        0      0 0.0.0.0:22              0.0.0.0:*               LISTEN      2088/sshd
tcp6       0      0 :::25                   :::*                    LISTEN      2755/master
tcp6       0      0 :::8090                 :::*                    LISTEN      29399/java
tcp6       0      0 :::28090                :::*                    LISTEN      4248/java
tcp6       0      0 :::443                  :::*                    LISTEN      25560/httpd
tcp6       0      0 :::28091                :::*                    LISTEN      4766/java
tcp6       0      0 127.0.0.1:8000          :::*                    LISTEN      29399/java
tcp6       0      0 127.0.0.1:28000         :::*                    LISTEN      4248/java
tcp6       0      0 127.0.0.1:28105         :::*                    LISTEN      2806/java
tcp6       0      0 :::3306                 :::*                    LISTEN      2651/mysqld
tcp6       0      0 :::11211                :::*                    LISTEN      2086/memcached
tcp6       0      0 :::80                   :::*                    LISTEN      25560/httpd
tcp6       0      0 :::28180                :::*                    LISTEN      2806/java
tcp6       0      0 :::22                   :::*                    LISTEN      2088/sshd
udp        0      0 127.0.0.1:323           0.0.0.0:*                           1807/chronyd
udp        0      0 0.0.0.0:11211           0.0.0.0:*                           2086/memcached
udp6       0      0 ::1:323                 :::*                                1807/chronyd
udp6       0      0 :::11211                :::*                                2086/memcached


# ss -nutlip

The above shows its result like below:

# ss -nutlp
Netid State      Recv-Q Send-Q                                                  Local Address:Port                                                                 Peer Address:Port
udp   UNCONN     0      0                                                           127.0.0.1:323                                                                             *:*                   users:(("chronyd",pid=1807,fd=1))
udp   UNCONN     0      0                                                                   *:11211                                                                           *:*                   users:(("memcached",pid=2086,fd=28))
udp   UNCONN     0      0                                                                 ::1:323                                                                            :::*                   users:(("chronyd",pid=1807,fd=2))
udp   UNCONN     0      0                                                                  :::11211                                                                          :::*                   users:(("memcached",pid=2086,fd=29))
tcp   LISTEN     0      100                                                                 *:25                                                                              *:*                   users:(("master",pid=2755,fd=13))
tcp   LISTEN     0      128                                                         127.0.0.1:6379                                                                            *:*                   users:(("redis-server",pid=2104,fd=4))
tcp   LISTEN     0      128                                                                 *:11211                                                                           *:*                   users:(("memcached",pid=2086,fd=26))
tcp   LISTEN     0      128                                                                 *:22                                                                              *:*                   users:(("sshd",pid=2088,fd=3))
tcp   LISTEN     0      100                                                                :::25                                                                             :::*                   users:(("master",pid=2755,fd=14))
tcp   LISTEN     0      32                                                                 :::8090                                                                           :::*                   users:(("java",pid=29399,fd=43))
tcp   LISTEN     0      10                                                                 :::28090                                                                          :::*                   users:(("java",pid=4248,fd=22))
tcp   LISTEN     0      128                                                                :::443                                                                            :::*                   users:(("httpd",pid=30042,fd=6),("httpd",pid=30041,fd=6),("httpd",pid=30034,fd=6),("httpd",pid=29707,fd=6),("httpd",pid=29698,fd=6),("httpd",pid=29695,fd=6),("httpd",pid=29647,fd=6),("httpd",pid=29642,fd=6),("httpd",pid=29049,fd=6),("httpd",pid=28993,fd=6),("httpd",pid=28802,fd=6),("httpd",pid=25560,fd=6))
tcp   LISTEN     0      128                                                                :::28091                                                                          :::*                   users:(("java",pid=4766,fd=65))
tcp   LISTEN     0      1                                                    ::ffff:127.0.0.1:8000                                                                           :::*                   users:(("java",pid=29399,fd=75))
tcp   LISTEN     0      1                                                    ::ffff:127.0.0.1:28000                                                                          :::*                   users:(("java",pid=4248,fd=80))
tcp   LISTEN     0      1                                                    ::ffff:127.0.0.1:28105                                                                          :::*                   users:(("java",pid=2806,fd=336))
tcp   LISTEN     0      128                                                                :::3306                                                                           :::*                   users:(("mysqld",pid=2651,fd=15))
tcp   LISTEN     0      128                                                                :::11211                                                                          :::*                   users:(("memcached",pid=2086,fd=27))
tcp   LISTEN     0      128                                                                :::80                                                                             :::*                   users:(("httpd",pid=30042,fd=4),("httpd",pid=30041,fd=4),("httpd",pid=30034,fd=4),("httpd",pid=29707,fd=4),("httpd",pid=29698,fd=4),("httpd",pid=29695,fd=4),("httpd",pid=29647,fd=4),("httpd",pid=29642,fd=4),("httpd",pid=29049,fd=4),("httpd",pid=28993,fd=4),("httpd",pid=28802,fd=4),("httpd",pid=25560,fd=4))
tcp   LISTEN     0      100                                                                :::28180                                                                          :::*                   users:(("java",pid=2806,fd=264))
tcp   LISTEN     0      128                                                                :::22                                                                             :::*                   users:(("sshd",pid=2088,fd=4))