π Fedora Cleaner
Interactive system cleanup and GPG fix tool for Fedora Linux
π Support
If you find this project useful, please consider supporting its development. Your support helps ensure the projectβs continued maintenance and improvement.
Sponsorship
You can support this project through GitHub Sponsors. Any level of support is greatly appreciated!
Other Ways to Contribute
- β Star the repository
- π Report bugs by opening an issue
- π‘ Suggest new features or improvements
- π Improve the documentation
- π Share the project with others
π Overview
Fedora Cleaner is a comprehensive, interactive bash script designed to clean up your Fedora system and fix common GPG signature issues. It provides detailed analysis, step-by-step cleanup plans, and full user control over what gets cleaned.
β¨ Key Features
- π Detailed System Analysis - Comprehensive scan of cache sizes, log files, and potential cleanup targets
- ποΈ Interactive Menu - Choose exactly what you want to clean
- π Before/After Reports - See exactly how much space was freed
- π GPG Fix - Resolves package signature verification issues
- β‘ Safe & Reliable - Careful handling of system files with confirmation prompts
- π Cleanup Plan - Prioritized list of cleanup actions with space estimates
π― What It Cleans
Category | Description | Typical Space Saved |
---|---|---|
π GPG Issues | Fixes package signature problems | N/A (Critical) |
π¦ Package Caches | DNF, PackageKit, libdnf5 caches | 500MB - 8GB |
π Browser Caches | Firefox, Chrome, Chromium thumbnails | 200MB - 3GB |
π° Log Files | Old system logs and journal cleanup | 100MB - 1GB |
π± Flatpak | Unused apps and cache cleanup | 100MB - 2GB |
ποΈ Old Kernels | Removes old kernel versions (keeps 2 latest) | 200MB - 1GB per kernel |
ποΈ Temp Files | Old temporary files from /tmp and /var/tmp | 50MB - 500MB |
π Quick Start
Method 1: Direct Download & Run
# Download the script
wget https://raw.githubusercontent.com/DevOpsTerminal/fedora-cleaner/main/fedora-cleaner.sh
# Make it executable
chmod +x fedora-cleaner.sh
# Run it
./fedora-cleaner.sh
Method 2: Clone Repository
# Clone the repository
git clone https://github.com/DevOpsTerminal/fedora-cleaner.git
# Navigate to directory
cd fedora-cleaner
# Make script executable
chmod +x fedora-cleaner.sh
# Run the script
./fedora-cleaner.sh
Method 3: One-liner
curl -fsSL https://raw.githubusercontent.com/DevOpsTerminal/fedora-cleaner/main/fedora-cleaner.sh | bash
π Sample Output
=== CLEANUP PLAN GENERATOR ===
Based on the analysis, here's what can be cleaned:
π CLEANUP PLAN:
1. [high] Clean package caches
πΎ Space: 99M + 120M + 86M
2. [medium] Clean browser caches
πΎ Space: thumbnails
3. [medium] Clean old log files
πΎ Space: 3.9G potential
4. [medium] Clean Flatpak (0
0 unused apps)
πΎ Space: 8.5G
5. [high] Remove old kernels (1)
πΎ Space: ~200MB each
6. [low] Clean temporary files
πΎ Space: 1.7G + 4.0K
7. [critical] Fix GPG signature issues
πΎ Space: No space saved
=== INTERACTIVE CLEANUP MENU ===
Choose what you want to do:
1. π Fix GPG signature issues (RECOMMENDED FIRST)
2. π¦ Clean package caches
3. π Clean browser caches
4. π° Clean log files
5. π± Clean Flatpak
6. ποΈ Remove old kernels
7. ποΈ Clean temporary files
8. π Execute ALL cleanup steps
9. π Show disk usage summary
0. β Exit
Enter your choice [1-9, 0 to exit]: 8
Execute ALL cleanup steps? [y/N]:
y
=== EXECUTING: Fix GPG signature issues ===
[INFO] Fixing GPG signature issues...
β Removing old GPG keys...
β Importing Google Chrome GPG key...
β Importing Fedora GPG keys...
β Refreshing repository metadata...
[SUCCESS] Step completed: Fix GPG signature issues
=== EXECUTING: Clean package caches ===
[INFO] Cleaning package caches...
β DNF cache before: 99M
β PackageKit cache before: 120M
β Cleaning DNF cache...
β Cleaning PackageKit cache...
β Cleaning libdnf5 cache...
[SUCCESS] DNF cache after: 99M
[SUCCESS] PackageKit cache after: 0
[SUCCESS] Step completed: Clean package caches
=== EXECUTING: Clean browser caches ===
[INFO] Cleaning browser caches...
β Cleaning thumbnails cache (24M)...
β Cleaning Mozilla cache (368M)...
β Cleaning Chromium cache (49M)...
[SUCCESS] Step completed: Clean browser caches
=== EXECUTING: Clean log files ===
[INFO] Cleaning log files...
β Journal size before:
β Cleaning journal logs (keeping 30 days)...
β Journal size after:
β Removing 29 old compressed log files...
[SUCCESS] Step completed: Clean log files
=== EXECUTING: Clean Flatpak ===
[INFO] Cleaning Flatpak...
./fedora-cleaner.sh: line 401: [: 0
0: integer expression expected
β Cleaning Flatpak caches...
β Repairing Flatpak installation...
[SUCCESS] Step completed: Clean Flatpak
=== EXECUTING: Remove old kernels ===
[INFO] Removing old kernels...
β Current kernels:
kernel-6.14.4-300.fc42.x86_64
kernel-6.14.5-300.fc42.x86_64
kernel-6.14.6-300.fc42.x86_64
β Removing old kernels (keeping latest 2)...
[SUCCESS] Kernels remaining: 2
[SUCCESS] Step completed: Remove old kernels
=== EXECUTING: Clean temporary files ===
[INFO] Cleaning temporary files...
β Cleaning /tmp (files older than 7 days)...
β Cleaning /var/tmp (files older than 7 days)...
β Removing 1 old files from /var/tmp...
[SUCCESS] Step completed: Clean temporary files
[SUCCESS] π All cleanup steps completed!
Press Enter to continue...
=== INTERACTIVE CLEANUP MENU ===
Choose what you want to do:
1. π Fix GPG signature issues (RECOMMENDED FIRST)
2. π¦ Clean package caches
3. π Clean browser caches
4. π° Clean log files
5. π± Clean Flatpak
6. ποΈ Remove old kernels
7. ποΈ Clean temporary files
8. π Execute ALL cleanup steps
9. π Show disk usage summary
0. β Exit
...
π§ Usage Examples
Fix GPG Issues Only
If youβre having package installation problems:
./fedora-cleaner.sh
# Choose option 1: Fix GPG signature issues
Full System Cleanup
For maximum space recovery:
./fedora-cleaner.sh
# Choose option 8: Execute ALL cleanup steps
Custom Cleanup
Pick and choose what to clean:
./fedora-cleaner.sh
# Use menu options 1-7 to select specific cleanup tasks
π‘οΈ Safety Features
- β Sudo Verification - Checks for proper permissions upfront
- β Confirmation Prompts - Asks before potentially destructive operations
- β Detailed Analysis - Shows exactly what will be cleaned before acting
- β Kernel Protection - Always keeps the 2 most recent kernels
- β User Data Safety - Only cleans cache files, never personal data
- β Graceful Errors - Continues operation even if individual steps fail
π Requirements
- OS: Fedora Linux (any recent version)
- Shell: Bash 4.0+
- Permissions: Sudo access required
- Dependencies: Standard Fedora utilities (dnf, rpm, find, du)
π Troubleshooting
Common Issues
Script hangs during repository refresh:
# The script includes timeouts and will automatically recover
# If stuck, press Ctrl+C and try running individual steps
Permission denied errors:
# Ensure you have sudo access
sudo -v
# Make sure script is executable
chmod +x fedora-cleaner.sh
GPG signature still failing after fix:
# Try manual Chrome installation
wget https://dl.google.com/linux/direct/google-chrome-stable_current_x86_64.rpm
sudo dnf install ./google-chrome-stable_current_x86_64.rpm
π€ Contributing
Contributions are welcome! Please feel free to submit a Pull Request.
Development Setup
git clone https://github.com/DevOpsTerminal/fedora-cleaner.git
cd fedora-cleaner
Adding New Features
- Follow the existing code style
- Add appropriate error handling
- Include user confirmations for potentially destructive operations
- Update the README with new features
π License
This project is licensed under the MIT License - see the LICENSE file for details.
π Acknowledgments
- Fedora community for the excellent documentation
- Contributors who helped test and improve the script
- Users who reported issues and suggested improvements
π Support
- π Bug Reports: GitHub Issues
- π‘ Feature Requests: GitHub Discussions
- π§ Questions: Open an issue with the βquestionβ label
π― Roadmap
- Support for other RPM-based distributions (RHEL, CentOS)
- Configuration file support
- Automated scheduling options
- Web-based interface
- Plugin system for custom cleanup modules
β If this tool helped you, please give it a star on GitHub!
Made with β€οΈ for the Fedora community