How to Clean the Package Cache on Linux
With apt clean and autoclean, to free up space without affecting installed programs.
APT keeps a copy of every downloaded package (in case you need to reinstall it without downloading again) — over time, this can pile up several GB without you noticing.
sudo apt clean
Removes the entire cache of downloaded packages — it doesn't affect already installed programs, only the saved copies from installation.
A gentler alternative: sudo apt autoclean — removes
only packages from old versions that can no longer be downloaded again
(because the repository already has a more recent version), keeping
the rest of the cache in case you need it soon.
Tip: combine this with removing orphaned packages for a more thorough system clean-up.
Frequently asked questions
Does cleaning the apt cache uninstall any program?
No, it only removes the downloaded copies used during installation — programs already installed on your system aren't affected at all.
What's the difference between apt clean and apt autoclean?
apt clean removes the entire cache. apt autoclean is more selective, removing only packages from versions that can no longer be downloaded again, keeping the rest.