How to check the opened ports in RHEL?

In this post, we are going to discuss about how to verify the listening ports.

For example, We’re going to check the ssh port 22/tcp is listening or not.

The simple and powerful command is netstat.

Flags:

  • t – For tcp protocol
  • p – Related process ID (PID)
  • l – Listening
[root@server~]# netstat -tpln
Active Internet connections (only servers)
Proto Recv-Q Send-Q Local Address               Foreign Address             State       PID/Program name
tcp        0      0 127.0.0.1:32000             0.0.0.0:*                   LISTEN      2204/java
tcp        0      0 127.0.0.1:38503             0.0.0.0:*                   LISTEN      1628/pbx_exchange
tcp        0      0 0.0.0.0:9898                0.0.0.0:*                   LISTEN      2204/java
tcp        0      0 0.0.0.0:111                 0.0.0.0:*                   LISTEN      1598/rpcbind
tcp        0      0 0.0.0.0:1556                0.0.0.0:*                   LISTEN      1628/pbx_exchange
tcp        0      0 127.0.0.1:1557              0.0.0.0:*                   LISTEN      1628/pbx_exchange
tcp        0      0 0.0.0.0:22                  0.0.0.0:*                   LISTEN      1959/sshd
tcp        0      0 127.0.0.1:25                0.0.0.0:*                   LISTEN      2083/master
tcp        0      0 0.0.0.0:24346               0.0.0.0:*                   LISTEN      1972/xinetd
[root@server~]#

Related posts

Leave a Comment