This repository contains shell scripts to automate system cleanup and disk space optimization.
It helps free up space by cleaning logs, caches, orphaned packages, and temporary files across Ubuntu/Proxmox servers.
- Truncate all log files under
/var/log(excludingwtmpandbtmp). - Delete rotated/compressed logs (
*.gz,*.1, etc.). - Vacuum systemd journal logs older than 7 days.
- Clear Nginx and RTMP logs.
- Clean APT cache and remove orphaned packages.
- Delete trash and manual pages.
- Show disk usage after cleanup.
wget -O log_cleanup.sh https://raw.githubusercontent.com/sohag1192/System-Cleanup-Script/main/log_cleanup.sh
chmod +x log_cleanup.shsudo ./log_cleanup.shEdit crontab:
crontab -eAdd this line to run daily at 3:00 AM:
0 3 * * * /root/log_cleanup.sh >> /root/log_cleanup.log 2>&1- clean-logs.sh – Apache2, Nginx, and Ubuntu cache cleanup.
- clean.sh – General cleanup script.
- clean_up.sh – Renamed version of
clean.sh. - log_cleanup.sh – Advanced Ubuntu log cleaner with disk usage report.
- Safe for production servers, but always review before deploying.
- Run periodically to maintain optimal performance.
- Requires
deborphanfor orphaned package removal.
# Ubuntu Log Cleaner
wget -O log_cleanup.sh https://raw.githubusercontent.com/sohag1192/System-Cleanup-Script/main/log_cleanup.sh
# Apache2/Nginx + Ubuntu cache cleanup
wget -O clean-logs.sh https://raw.githubusercontent.com/sohag1192/System-Cleanup-Script/main/clean-logs.sh
# General cleanup script
wget -O clean_up.sh https://raw.githubusercontent.com/sohag1192/System-Cleanup-Script/main/clean_up.sh
# Proxmox cleanup script
wget -O proxmox-cleanup.sh https://raw.githubusercontent.com/sohag1192/System-Cleanup-Script/main/proxmox-cleanup.sh
# Alternate Proxmox cleanup script
wget -O proxmox_clean.sh https://raw.githubusercontent.com/sohag1192/System-Cleanup-Script/main/proxmox_clean.sh- log_cleanup.sh – Advanced Ubuntu log cleaner with disk usage report
- clean-logs.sh – Apache2, Nginx, and Ubuntu cache cleanup
- clean_up.sh – General cleanup script (renamed from
clean.sh) - proxmox-cleanup.sh – Proxmox‑specific cleanup with cache/log removal
- proxmox_clean.sh – Alternate Proxmox cleanup script
- Run
chmod +x scriptname.shafter download. - Execute with
sudo ./scriptname.sh. - (Optional) Add to cron for scheduled cleanup.
This way you’ll have all log cleanup scripts locally, ready to run or customi
Md. Sohag Rana
Network & IT Infrastructure Manager, Sarker Net
📧 Email: sohag1192@gmail.com
💬 Telegram: sohag1192