Site icon New Generation Enterprise Linux

Stop apt from holding onto deleted package archives

Package Management (Apt/Dnf/Pacman Internals)

Stop apt from holding onto deleted package archives

đź§© The Challenge

Dealing with a server that suddenly runs out of disk space is a nightmare, especially when half of it is just useless old .deb files clogging up your /var cache. You’d think the package manager would clean up after itself, but it just keeps hoarding everything like a digital packrat.

đź’ˇ The Fix

Running the clean command periodically purges those stale package files from your local repository cache. It’s an easy win for clearing up gigabytes of junk without breaking your actual installed apps.

sudo apt-get clean

⚙️ Why It Works

This command wipes out the entire contents of the /var/cache/apt/archives directory, which acts as a staging area for every package you’ve downloaded. Because apt doesn’t automatically prune these files, they just sit there consuming space until you manually kick them to the curb.

🚀 Pro-Tip: Use autoclean instead of clean if you want to keep the packages that are currently available for download but dump the ones that have already been replaced by newer versions.

Linux Tips & Tricks | © ngelinux.com | 7/30/2026

0 0 votes
Article Rating
Exit mobile version