Learn how to clear the DNF Cache in Centos 8. Our Server Management Support team is here to help you with your questions and concerns.
How to Clear DNF Cache Centos 8
Did you know that DNF caches files in the /var/cache/dnf directory by default?
Manually deleting the files and directories can be a time-consuming task. This is where the dnf clean command comes in handy.
.
However, before we use this command, our experts recommend using the du command to get the size of the /var/cache/dnf directory.
For example:
~]$ du -hs /var/cache/dnf
426M /var/cache/dnf
Now, in order to clear the DNF package cache, we have to use the dnf clean command followed by the type of cache we want to clean.
Let’s take a look at the three types of cache we can clean:
- all:
This cleans all the cached packages. This includes metadata and individual package files.
- metadata:
This will clean only the repository metadata.
- packages:
If we want to clean downloaded package files, we have to use this.
So, if we want to clean all the cached data we have to use this command:
sudo dnf clean all
Alternatively, we can clear the metadata or package cache by replacing “all” with “metadata” or “packages” in the command.
After running the dnf clean command, we can verify that the cache is cleared with this command:
dnf list
This command lists the available packages, and if the dnf clean command is successful, we will not see any cached package data.
At the end of the day, clearing the DNF cache helps us remove unnecessary files, thereby freeing up disk space.
[Need assistance with a different issue? Our team is available 24/7.]
Conclusion
In brief, our Support Experts demonstrated how to clear the DNF Cache in Centos 8.
PREVENT YOUR SERVER FROM CRASHING!
Never again lose customers to poor server speed! Let us help you.
Our server experts will monitor & maintain your server 24/7 so that it remains lightning fast and secure.
0 Comments