Skip to content

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.

License

Notifications You must be signed in to change notification settings

DevOpsTerminal/fedora-cleaner

πŸš€ Fedora Cleaner

Interactive system cleanup and GPG fix tool for Fedora Linux

License Bash Fedora GitHub Sponsors

πŸ’– 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

🎯 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

About

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.

Topics

Resources

License

Code of conduct

Contributing

Stars

Watchers

Forks

Sponsor this project

 

Packages

No packages published