Cleanup Scripts - XsMagical/Linux-Tools GitHub Wiki

Cleanup Scripts

The Cleanup Scripts in Linux Tools are designed to safely remove unnecessary files, packages, and caches from your Linux system without breaking anything important.

🎯 Purpose

  • Free up disk space by removing unneeded system files and packages.
  • Keep the system optimized without risking essential components.
  • Provide optional deep-clean modes for advanced users.

🖥️ Script Details

File: universal_cleanup.sh

  • Works on Fedora/RHEL, Ubuntu/Debian, Arch, and openSUSE.
  • Detects your package manager and removes:
    • Orphaned/unneeded packages
    • Old package caches
    • Unused Flatpak runtimes and apps
    • Disabled Snap revisions
    • Old logs and journal files
    • User thumbnails and trash
    • Development caches (pip, npm, yarn, cargo)
  • Optional cleaning:
    • Steam shader and GPU caches
    • Unused Docker images, containers, and volumes
  • Skips already clean areas for faster runs.
  • Logs every action for review.

🔗 Location

https://github.com/XsMagical/Linux-Tools/tree/main/scripts/cleanup

📋 Notes

  • Designed to be safe by default — no destructive actions unless specifically enabled with flags.
  • Can be re-run periodically to maintain a clean system.