A script to automate Arch Linux cleanup by removing cache, orphaned packages, old logs, and unused resources, helping optimize system storage.
- Cleans package cache, keeping only the latest three versions of each installed package
- Removes orphaned packages (unused dependencies)
- Cleans old system logs and limits log size to 100MB
- Optionally clears AUR build cache (if using
yay
) - Optionally removes unused Docker resources (containers, images, and volumes)
- Provides a disk usage summary after cleanup
- Arch Linux or an Arch-based distribution
- Optional:
yay
(for cleaning AUR build cache) and Docker (for Docker cleanup)
- Clone the repository:
git clone https://github.com/yourusername/arch-linux-cleanup.git cd arch-linux-cleanup
- Make the script executable:
chmod +x clean_arch.sh
To perform the cleanup, run the script with root privileges:
sudo ./clean_arch.sh
The script will output the status of each cleanup step, and a final disk usage summary to confirm reclaimed space.
Use this script carefully and only if you are comfortable with system maintenance tasks. Always review and understand each command within the script, especially if making modifications.
Feel free to open issues or submit pull requests to improve the script. Contributions are welcome!
This project is licensed under the MIT License.