Related to apt cache location

Clear apt-cache on Debian 10

This article covers how to clear the cache created by apt in a completely safe way. It is faster and simpler than manually deleting the cache directory. apt (Advanced Packaging Tool) is the package installation and dependency management tool in Debian and other Debian-based distributions. It works on top of 'Dpkg' which is nothing but the Debian package installer.

The way apt installs packages is: it downloads the package for the required software, and additionally it downloads the packages for all the dependencies for the required software.

Clear Apt Cache on Ubuntu 20.04 - Best Method ?

This article covers the best method of listing and cleaning the apt cache on your Ubuntu system. Ubuntu users can clean Apt archive cache using sudo apt-get clean and sudo apt-get autoclean commands. The apt-get is a APT package handling utility or the command-line tool for handling packages. These commands clears out the local repository. The autoclean command only removes packages and files that are no longer in use. Ubuntu users can also do the same task from Synaptic package manager. Open Synaptic, go to Settings > Preferences > File tab. Select to delete packages that are no longer in use.

To clean Apt archive cache folder on Ubuntu, run:

$ sudo apt-get update
$ sudo apt-get clean
$ sudo apt-get autoclean

  • clean – clean clears out the local repository of retrieved package files. It removes everything but the lock file from /var/cache/apt/archives/ and /var/cache/apt/archives/partial/.
  • autoclean – Like clean, autoclean clears out the local repository of retrieved package files. The difference is that it only removes package files that can no longer be downloaded, and are largely useless. This allows a cache to be maintained over a long period without it growing out of control. The configuration option APT::Clean-Installed will prevent installed packages from being erased if it is set to off.