12

What command can I use to clear the yum cache on a Fedora 23 system? I have tried yum clean all, but it defaults to:

Redirecting to '/usr/bin/dnf clean all' (see 'man yum2dnf')

with "0 files removed"

  • 1
    It's possible that you simply don't have any files in your cache to clear. Is there anything that leads you to believe you have packages, metadata, or anything else in your cache? – jayhendren Nov 11 '16 at 19:05
  • 1
    Yes, I ran a disk usage analyzer and found that /var/cache/yum contained the sub-directory /x86_64/23 that contains 287 items storing 1.4 GB of data. – eHansen Nov 11 '16 at 19:10
  • 1
    Lucky you my /var/cache/yum weighs 22G: 4.5G for /26/ and 12G for /27/. There's also an almost empty /28/ directory, weird. – MarcH Feb 21 '19 at 1:25
  • I have seen similar to that too. Now I manage a lot of that disk space using BleachBit, and run it via Terminal as root. It cleans most all the common cache builders, plus the system files too. – eHansen Feb 23 '19 at 4:02
19

According to the documentation for dnf clean:

Performs cleanup of temporary files kept for repositories. This includes any such data left behind from disabled or removed repositories as well as for different distribution release versions.

dnf clean dbcache

Removes cache files generated from the repository metadata. This forces DNF to regenerate the cache files the next time it is run.

dnf clean expire-cache

Marks the repository metadata expired. DNF will re-validate the cache for each repo the next time it is used.

dnf clean metadata

Removes repository metadata. Those are the files which DNF uses to determine the remote availability of packages. Using this option will make DNF download all the metadata the next time it is run.

dnf clean packages

Removes any cached packages from the system.

dnf clean all

Does all of the above.

So if dnf clean all did not clean it up, then it's not part of the dnf cache. The dnf cache lives in /var/cache/dnf; /var/cache/yum may be leftover from a previous version of Fedora (prior to the upgrade from yum to dnf), and you can almost certainly remove the files in that directory safely.

| improve this answer | |
  • I have found, actually reminded recently that Bleach Bit (bleachbit.org) does and excellent job on finding/cleaning out system clutter. – eHansen Dec 19 '16 at 18:30

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.