Skip to content

Instantly share code, notes, and snippets.

@ppcdias
Created June 18, 2024 16:49
Show Gist options
  • Save ppcdias/a2bdd5ed5481a1d5074e56d120265f79 to your computer and use it in GitHub Desktop.
Save ppcdias/a2bdd5ed5481a1d5074e56d120265f79 to your computer and use it in GitHub Desktop.
WHM/cPanel Useful Terminal Commands for Managing and Optimizing Server
# List All error_log Files
find /home/*/public_html -type f -name error_log -exec du -sh {} \;
# Clear All error_log Files
find /home/*/public_html -type f -iname error_log -delete
# Import a .sql File into a MySQL Database
mysql -u root -p dbname < /home/username/database.sql
# Get a List of the Most Frequent IP Addresses in Apache Logs
cat /usr/local/apache/logs/access_log | awk '{print $1}' | sort | uniq -c | sort -nr | head -n 20
# Execute a cPanel Backup Immediately
/usr/local/cpanel/bin/backup
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment