Stop APT from leaving your cached deb files everywhere
Package Management (Apt/Dnf/Pacman Internals)
Stop APT from leaving your cached deb files everywhere
🧩 The Challenge
You look at your disk usage and realize /var/cache/apt/archives is sitting on five gigs of ancient deb files from three release cycles ago. It’s annoying because apt-get clean only nukes the whole pile, and I usually want to keep at least the last few just in case I need to downgrade in a hurry.
💡 The Fix
Use apt-get autoclean instead of clean to prune the junk while keeping the current version of whatever you have installed. It saves your bacon when you break a library and realize the mirrors already swapped out the files for a newer, buggier one.
apt-get autoclean
⚙️ Why It Works
This command scans your local archive directory and only removes package files that can no longer be downloaded from your configured repositories, effectively trimming the dead weight while keeping the useful stuff.
🚀 Pro-Tip: Alias this to apt-autoclean if you’re tired of reaching for the full string every month.
Linux Tips & Tricks | © ngelinux.com | 9/14/2026
