Package Management (Apt/Dnf/Pacman Internals)
Stop DNF from leaving behind transaction breadcrumbs
đź§© The Challenge
Dealing with a disk that is suddenly at 100% because DNF decided to keep every single history file and transaction log from the last three years is a nightmare. I once had a production node choke during a patch cycle because the /var/cache directory was bloated with old metadata I didn’t even know existed.
đź’ˇ The Fix
Use the history cleanup tools built into the package manager to prune the logs and free up that wasted space. It keeps your system lean without breaking the dependency tracking you actually need.
dnf history expire --destructively --before now
⚙️ Why It Works
Running this command forces DNF to purge historical transaction logs older than the current date, which clears out the clutter that accumulates in the history database. You’re effectively telling the manager to stop obsessing over ancient installs that aren’t relevant to your current state.
🚀 Pro-Tip: Run this as a monthly cron job to keep your log directory from turning into a digital hoarders nest.
Linux Tips & Tricks | © ngelinux.com | 8/9/2026
