Both DNF and APT, the bundle managers for Red Hat and Ubuntu-based Linux distributions, retailer cached data to make sure that the software program set up course of is way quicker and extra dependable. With these caches lively, neither bundle supervisor has to obtain data each time you attempt to replace, replace, or set up software program.
But generally cache data can turn out to be out of date or corrupted. When this occurs, you might discover that APT’s DNF is not working correctly.
What are you doing? Clear the cache, which is able to delete all that data, so you’ve a clear slate.
How do you clear these caches? Let me present you.
SEE: Debian vs Ubuntu: Which Linux distribution most closely fits your wants? (Technology Republic)
How to clear cache for DNF bundle supervisor
The greatest method to clear the DNF cache is to run the command:
sudo dnf clear dbcache
This will take away any cache information generated by the repository metadata.
If that does not clear up your issues, you possibly can carry out a full cleanup with the command:
sudo dnf clear all
SEE: Top instructions Linux directors must know (TechRepublic Premium)
How to clear cache for APT bundle supervisor
With the APT bundle supervisor you possibly can subject the command:
sudo apt-get clear
This will take away the contents from /var/cache/apt/archives (apart from the lock file).
Another APT choice is to run:
sudo apt-get autoclean
This solely removes packages that can’t be downloaded from the repositories. In different phrases, in case you downloaded a .deb bundle and put in it (slightly than putting in it from a distant repository), any information related to that bundle will stay.
And that is all you’ll want to clear bundle supervisor caches for each Red Hat and Ubuntu-based distributions. You most likely will not have to make use of these instruments, however in case you do, you understand how.
This article was initially revealed in June 2021. It was up to date by Antony Peyton in January 2025.