What command can I use to clear the 'yum' cache, on Fedora 23 system?

34,753

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.

Share:
34,753

Related videos on Youtube

eHansen
Author by

eHansen

Updated on September 18, 2022

Comments

  • eHansen
    eHansen over 1 year

    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"

    • jayhendren
      jayhendren over 7 years
      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?
    • eHansen
      eHansen over 7 years
      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.
    • Gaojin
      Gaojin about 5 years
      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.
    • eHansen
      eHansen about 5 years
      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.