How to check for opened ports on CentOS?

There are a few methods to view the open ports:

  1. Use the netstat command to view all current network connections and open ports.
netstat -tuln
  1. Check the open ports using the ss command.
ss -tuln
  1. Check the ports that are currently open using the lsof command.
lsof -i -P -n | grep LISTEN

These commands will display all the listening ports on the current system along with the corresponding process information.

bannerAds