Disk space is the storage allocated for your hosting account. It includes website files, databases, email accounts, backups, and logs. Managing it efficiently ensures your site runs smoothly and prevents service interruptions.
# Check total usage
du -sh ~/
# Check specific directory
du -sh ~/public_html
# List all directories with sizes
du -h --max-depth=1 ~/public_html | sort -hr
# Check quota
quota -s# Find largest files
find ~/ -type f -size +10M -exec ls -lh {} \; | sort -k 5 -hr | head -20
# Find large directories
du -h ~/public_html | sort -hr | head -20
# Find files by type
find ~/public_html -name "*.zip" -exec ls -lh {} \;# Find and remove large logs
find ~/logs -name "*.log" -size +100M -delete
# Truncate error log
> ~/public_html/error_log
# Clear all log files
find ~/logs -type f -name "*.log" -exec sh -c '> "$1"' _ {} \;wp transient delete --all
wp post delete $(wp post list --post_type='revision' --format=ids) --force
wp db optimizeAdd to wp-config.php:
define('WP_POST_REVISIONS', 3);
define('AUTOSAVE_INTERVAL', 300);
define('EMPTY_TRASH_DAYS', 7);SELECT
table_name AS 'Table',
ROUND(((data_length + index_length) / 1024 / 1024), 2) AS 'Size (MB)'
FROM information_schema.TABLES
WHERE table_schema = 'your_database'
ORDER BY (data_length + index_length) DESC;Symptoms:
Immediate Actions: