CentOS 7 Firewall Common Commands

Disabling the Firewall

systemctl disable firewalld

Enabling the Firewall

systemctl disable firewalld

Status of the Firewall

firewall-cmd --state

Allowing Ports

firewall-cmd --permanent --zone=public --add-port=2223/tcp

firewall-cmd --reload

Check Active Zone & Open Ports

firewall-cmd --list-all-zones

Shows Default Zone

firewall-cmd --get-default-zone

Finding and Removing Large error_log Files on Linux

Many of the commands listed on this page are more suited for a server running the WHM / cPanel environment, WHM / cPanel keeps user’s websites and error_log files underneath their /home/ directory.

If you wanted to apply this command to systems that were not using WHM / cPanel then you might change the page mention in the commands below from: /home*/*/public_html/ to be / instead.

Find and Remove

The command below will find and remove error_log files irrespective of their size.

find /home*/*/public_html/ -type f -name "error_log" -exec rm -f {} \;

Find and Remove error_log files only if they are over 50mb

find /home*/*/public_html/ -name "error_log" -size +5000k -exec ls -lah {} \;