Cleaning APT

By Lenny Metlitsky @leomet07, David Chen @TheEgghead27

Clearing the cache on Debian/Ubuntu (or their derivatives, such as PopOS)

  1. Cleaning up orphaned packages
sudo apt autoremove
  1. Preview of the cache and of what clearing/deleting the cache will delete
sudo apt clean --dry-run

Example:

debby@linodebox:~$ sudo apt clean --dry-run
Del /var/cache/apt/archives/* /var/cache/apt/archives/partial/*
Del /var/lib/apt/lists/partial/*
Del /var/cache/apt/pkgcache.bin /var/cache/apt/srcpkgcache.bin
debby@linodebox:~$
  1. Clear the cache
sudo apt clean

If clearing the cache is successful, this command will have no output.

go home