Apt (Advanced Packaging Tool) is a command-line package installation and dependency management utility in Debian-based distributions.
When you install packages in Debian using the apt-get or apt command, a copy of the .deb file is saved in the /var/cache/apt/archives directory. If you uninstall and reinstall a package, your system will look for it in the cache and download it from there rather than downloading it again.
If you run out of disk space on your Debian system, you can clear the apt-cache and free up some space.
Here at Ibmi Media, as part of our Server Management Services, we regularly help our Customers to perform related Apt cache queries on Linux system.
In this context, we shall look into how to clear the apt-cache on Debian.
How to Use apt clean Command ?
To clear the apt-cache, use the apt clean command to erase all files in the cache directory:
$ sudo apt clean
The user doesn't need to manually delete the cache directory.
You can run the apt clean command with an option called —dry-run. This will simply display the folders from which packages will be deleted:
$ sudo apt clean --dry-run
How to Use apt auto-clean Command ?
This command removes all saved archives for packages that can no longer be downloaded from your cache. The packages are either no longer in the repository or have a newer version available in the repo. This command cleans obsolete Debian packages:
$ sudo apt autoclean
[Need to Install Open-source Software on your Linux system ? We can help you. ]