Stop your package manager from eating disk space with old cache files
Package Management (Apt/Dnf/Pacman Internals)
Stop your package manager from eating disk space with old cache files
🧩 The Challenge
Dealing with a production server that suddenly hits 100 percent disk usage is a nightmare, especially when it turns out to be gigabytes of stale package headers and archives you don’t even need anymore. I’ve spent way too long cleaning up directories by hand before realizing the tools are already there to handle it.
💡 The Fix
Use the built-in clean mechanisms to prune the local caches. It frees up space without touching the packages currently installed on the system.
apt-get clean && apt-get autoclean
⚙️ Why It Works
These commands wipe the retrieved package files from the local repository directory, effectively dropping the stuff that is either outdated or has been superseded by newer versions in the repo.
🚀 Pro-Tip: Run this after every major dist-upgrade to keep your partition headroom healthy.
Linux Tips & Tricks | © ngelinux.com | 9/6/2026
