IFS=$'\n'; for i in `firewall-cmd --direct --get-all-rules`; do firewall-cmd --permanent --direct --remove-rule $i && firewall-cmd --reload; done
The above command throws error as usage: --permanent --direct --remove-rule { ipv4 | ipv6 | eb }
After I enabled shell verbose option, I noticed that the command is as follows:
firewall-cmd --permanent --direct --remove-rule 'ipv4 filter OUTPUT 2 -o ens32 -p udp -m conntrack --ctstate NEW -j ACCEPT'
I am not really sure from where the single quotes around the rule is getting substituted and how to get rid of it.