How to check open ports in firewalld on Linux?

In Linux, you can use the following command to view the open ports in firewalld:

  1. Firstly, make sure that the firewalld service is installed and running. You can use the following command to check the status of the firewalld service:
systemctl status firewalld
  1. List the ports that have been opened in firewalld using the following command:
firewall-cmd --list-ports

This command will show a list of all open ports.

  1. If you only want to check if a specific port is open, you can use the following command:
firewall-cmd --query-port=<port_number>/tcp

Replace with the specific port number you want to check. If the output is “yes,” it means the port is open; if the output is “no,” it means the port is closed.

These commands can help you check the open ports in firewalld and the status of specific ports.

bannerAds