firewall-cmd List Rules on Linux: RHEL, AlmaLinux & Rocky

firewall-cmd list rules - custom-fwcmd51-featured.png

firewall-cmd list rules is a common RHEL-family search — admins need the exact flags to audit a host. Compare: UFW vs firewalld.

Default zone

See active zone and whether firewalld runs.

bashstatus
sudo firewall-cmd --state
sudo firewall-cmd --get-default-zone
status
zone

List everything

--list-all for current zone in one screen.

bashlist
sudo firewall-cmd --list-all
sudo firewall-cmd --list-all --zone=public
--list-all
all

Ports and services

Separate lists when scripting.

bashports
sudo firewall-cmd --list-services
sudo firewall-cmd --list-ports
ports
services

Permanent rules

Runtime vs permanent; always --reload after –permanent.

bashperm
sudo firewall-cmd --permanent --add-service=https
sudo firewall-cmd --reload
--permanent
reload

Quick Reference

Related tutorials

Diagrams are original illustrations by Gnome IT Solutions. Tutorial text © Gnome IT Solutions.