Alt Text

A screenshot of a file manager preview window for my ~/.cache folder, which takes up 164.3 GiB and has 246,049 files and 15,126 folders. The folder was first created about 1.75 years ago with my system

  • bizdelnick@lemmy.ml
    link
    fedilink
    arrow-up
    88
    ·
    edit-2
    9 months ago

    You don’t have to clean your ~/.cache every now and then. You have to figure out which program eats so much space there, ensure that it is not misconfigured and file a bugreport.

  • ryannathans@aussie.zone
    link
    fedilink
    arrow-up
    53
    ·
    9 months ago

    I did this and now my games have no icons in lutris, some of my gnome settings got reset and my proton email bridge stopped working

    • Zangoose@lemmy.worldOP
      link
      fedilink
      English
      arrow-up
      23
      ·
      9 months ago

      It looks like yay was storing AUR build files there, that folder took up about 160 of the 164GiB

      • SuperIce@lemmy.world
        link
        fedilink
        English
        arrow-up
        16
        ·
        9 months ago

        You can use yay -Sc to clean the cache. It’ll also ask you if you want to clean the pacman cache, which I’m assuming you also haven’t cleaned (check the size of /var/cache/pacman).

      • MonkderZweite@feddit.ch
        link
        fedilink
        arrow-up
        2
        ·
        edit-2
        9 months ago

        Shouldn’t it store that stuff in data-home or state-home? Pikaur compiles in cache and stores it in data-home after.

      • SuperIce@lemmy.world
        link
        fedilink
        English
        arrow-up
        13
        ·
        9 months ago

        Pacman’s cache isn’t in ~/.cache though, it’s in /var/cache. So whatever is taking up this much space isn’t the package manager.

        That being said, I think the arch devs should add a config option to automatically delete old packages without having to run paccache manually and have it default to the last 2 versions of a package or so. It can grow quite big over time.

  • neonred@lemmy.world
    link
    fedilink
    arrow-up
    25
    arrow-down
    1
    ·
    edit-2
    9 months ago

    Because of excessive RAM I symlink ~/.cache to /tmp. Additionally installing zramswap helps for this scenario.

    Benefits are faster access, automatc purging between reboots and no wear to the NMVe drive.

    Yes, this is a single user scenario.

  • Dog@lemmy.world
    link
    fedilink
    English
    arrow-up
    17
    arrow-down
    1
    ·
    9 months ago

    Question, could you have cron/crontab do it monthly or something? Do it monthly meaning delete everything in ~/.cache every month or so?

      • BaroqueInMind@kbin.social
        link
        fedilink
        arrow-up
        8
        ·
        9 months ago

        This is the good shit I miss from reddit. Thank you for posting a systemd service config, I’m going to implement this.

      • Zangoose@lemmy.worldOP
        link
        fedilink
        English
        arrow-up
        3
        ·
        9 months ago

        Thanks for this! I’ve been meaning to start getting into learning more about systemd and making services, this is super detailed and gives me a pretty good starting point!

    • bizdelnick@lemmy.ml
      link
      fedilink
      arrow-up
      4
      ·
      9 months ago

      Don’t. You don’t need to clean it unless cache of some buggy program grows uncontrollable.

    • Zangoose@lemmy.worldOP
      link
      fedilink
      English
      arrow-up
      3
      ·
      9 months ago

      I just found this today, I don’t really know anything about cron jobs but this will probably incentive me to learn lol

      • SuperIce@lemmy.world
        link
        fedilink
        English
        arrow-up
        9
        ·
        9 months ago

        Did you happen to see which subdirectory was using up this much space? I don’t think I’ve ever seen .cache go above 10GB, so this may be a bug in a piece of software you use.

          • Zangoose@lemmy.worldOP
            link
            fedilink
            English
            arrow-up
            4
            ·
            edit-2
            9 months ago

            Looks like yay is storing every previous binary for AUR bin packages (also excuse the unreadable terminal theme, it doesn’t play very well with a lot of TUI apps unless they support custom theming)

            • neonred@lemmy.world
              link
              fedilink
              arrow-up
              2
              ·
              edit-2
              9 months ago

              Wow, I’ve never seen something like this.

              Is it" allowed"? I mean, there are quotas for user homes.

    • cmnybo@discuss.tchncs.de
      link
      fedilink
      English
      arrow-up
      3
      ·
      9 months ago

      You could have a cronjob run something like find /home/user/.cache -type f -atime +30 -delete, which would find files that haven’t been accessed in the last 30 days and delete them. Make sure your home partition is not mounted with the noatime option though.

  • majestic@sh.itjust.works
    link
    fedilink
    arrow-up
    14
    arrow-down
    1
    ·
    9 months ago

    No way. If i clean up my .cache directory my precious cached with sccache rust deps would be very upset. >:[

    • Zangoose@lemmy.worldOP
      link
      fedilink
      English
      arrow-up
      10
      ·
      9 months ago

      No, .cache is similar to a temporary directory (or at least in theory) where important data isn’t supposed to be stored there, instead only temporary files that might speed things up (e.g. images in a browser or thumbnails in a file manager). In this case it looks like all of my AUR packages had their source files cached, which added up over the ~1.75 years that I’ve been running this distro

      • conorab@lemmy.conorab.com
        link
        fedilink
        arrow-up
        1
        ·
        9 months ago

        Ah I was getting it confused. At one point Steam stored everything in ~/.local/share/steam and symlinked ~/.steam to it. Doesn’t appear to be the case on Ubuntu 22.04, though I used to use Debian and grab the .deb from Valve’s website. My bad! :)

  • just_another_person@lemmy.world
    link
    fedilink
    arrow-up
    7
    arrow-down
    4
    ·
    9 months ago

    This particular folder caches many things from various package managers. Won’t hurt to clear, but will fill up again. Maybe consider not using caches when engaging such things.

      • just_another_person@lemmy.world
        link
        fedilink
        arrow-up
        4
        arrow-down
        1
        ·
        9 months ago

        It’s a cache folder. Created by the distro. They labelled it as such because it’s cache, and can be considered ephemeral. It won’t do any permanent damage to anything unless you’ve accidentally been using it for something else.

    • bizdelnick@lemmy.ml
      link
      fedilink
      arrow-up
      1
      arrow-down
      1
      ·
      9 months ago

      Package managers don’t use this directory as well as any other subdirectory of user’s home.

      • just_another_person@lemmy.world
        link
        fedilink
        arrow-up
        1
        ·
        9 months ago

        Could have fooled me, because it’s certainly the default for things like brew, flatpak, mpm, and pip. Looks like npm and maven use it on certain Debian based distros as well. I’m betting more of the immutable distros use that directory as well vs something in /var/cache.

  • Possibly linux@lemmy.zip
    link
    fedilink
    English
    arrow-up
    2
    ·
    9 months ago

    Check which folder is the biggest. I am going to go on a lim and say it probably is being caused by file roller

    • Zangoose@lemmy.worldOP
      link
      fedilink
      English
      arrow-up
      3
      ·
      9 months ago

      It’s yay, which took up ~160 GiB. It was storing previous versions of AUR binaries which I guess added up over time. I posted a screenshot of ncdu outputs for a more detailed breakdown in one of the other reply threads

  • Jinn@sh.itjust.works
    link
    fedilink
    arrow-up
    6
    arrow-down
    59
    ·
    9 months ago

    This is one of those things that makes me shake my head about Linux. It’s these small dumb problems that make Linux inaccessible to the common person.

      • Jinn@sh.itjust.works
        link
        fedilink
        arrow-up
        4
        arrow-down
        35
        ·
        9 months ago

        They do have small annoying issues. This is not one of them. This is something that would completely baffle a non-tech literate person. They’d just observe their computer becoming slow or not having space and say “well, Linux must have broken my computer.”

        • d3Xt3r@lemmy.nzM
          link
          fedilink
          arrow-up
          33
          ·
          edit-2
          9 months ago

          FYI, Windows doesn’t have any feature either to automatically clear all of it’s temp folders (%TMP%, C:\Windows\Temp, C:\Windows\Panther), plus several other folders where orphaned files are often leftover, such as C:\Windows\Installer, C:\Windows\CSC, and various folders and cache files in your AppData\Local etc, to name a few off the top of my head.

          I used to be a Windows sysadmin for a long time, and let me tell you, HDDs becoming completely full due to cache/temp files is very much a problem in Windows.

          • Astaroth@lemm.ee
            link
            fedilink
            arrow-up
            2
            ·
            9 months ago

            Guess what I found in /home/{user}/.wine/drive_c/users/{user}/Temp, 10GB of log files. Although 9GB was from one time when I used Cheat Engine and I don’t know what really happened tbh besides it causing a OOM crash.

            It created a 9GB sized file called ADDRESSES.TMP, I never considered checking for temp files in .wine before. And I guess I should be checking all the prefixes created by Steam games as well…

          • Infiltrated_ad8271@kbin.social
            link
            fedilink
            arrow-up
            2
            arrow-down
            8
            ·
            edit-2
            9 months ago

            This has not been the case since at least w10, it has a tool to automatically clean several temp files and recycle bin.

        • atzanteol@sh.itjust.works
          link
          fedilink
          arrow-up
          18
          arrow-down
          1
          ·
          edit-2
          9 months ago

          Oh yeah, you never hear such complaints about Windows or MacOS.

          BTW can you recommend any good tools to cleanup my registry?

        • fluffyb@lemmy.fluffyb.net
          link
          fedilink
          arrow-up
          11
          ·
          9 months ago

          I once had a huge 20ish GB file in windows I could not get rid of, move, or delete. It was related to hibernation or something like that… Even though I had hibernation disabled and no amount of googling could get rid of the file.

          This is something that would completely baffle a non-tech literate person. They’d just observe their computer becoming slow or not having space and say “well, my computer just broke itself better throw it in the trash and get a new one”

      • cmnybo@discuss.tchncs.de
        link
        fedilink
        English
        arrow-up
        7
        ·
        9 months ago

        I’ve never seen any of my ~/.cache directories get more than a few GB either and I never bother to clean them.
        I am curious what OP was doing that used that much space though. That’s certainly not typical.

        • Zangoose@lemmy.worldOP
          link
          fedilink
          English
          arrow-up
          4
          ·
          9 months ago

          It was AUR packages from yay. I’m a CS major into gaming and emulation so there are a decent amount of programming build tools from the aur that I had, it looks like most of it is coming from storing all of the binaries from AUR packages, as intelliJ ultimate takes up 50 GiB, proton-ge-custom takes up 31 GiB, and Yuzu emulator takes up 16 GiB.

        • aleq@lemmy.world
          link
          fedilink
          arrow-up
          1
          ·
          9 months ago

          I get the same all the time. OP reminded me to check today and Jetbrains toolbox had cached a lot of downloads that took up 42 GB in total. yarn folder with 2.3 GB. bazel folder with 15 GB (apparently used for building Anki),7 GB paru clones.

          All in all it added up to 82 GB.

    • SuperIce@lemmy.world
      link
      fedilink
      English
      arrow-up
      13
      ·
      9 months ago

      Not really. I’ve never seen .cache get bigger than 10GB, which is about how big the temporary files in Windows get if you never clean them.

    • UndercoverUlrikHD@programming.dev
      link
      fedilink
      arrow-up
      12
      ·
      9 months ago

      I’ve seen similar issues in appdata on windows when a program is poorly configured and simply grow its logs to ridiculous sizes. It’s an issue with a program utilising that folder, not the os.

    • TheWoozy@lemmy.world
      link
      fedilink
      arrow-up
      1
      ·
      9 months ago

      I’ve been running Linux as my primary OS since the late 90s and have never run into this problem.

    • JubilantJaguar@lemmy.world
      link
      fedilink
      arrow-up
      3
      arrow-down
      3
      ·
      9 months ago

      The hate you’re getting for this is so revealing and depressing. It basically proves you right.

      To the haters: where is the factual problem with this personal opinion? Have you considered making a counter-argument instead, instead of simply lashing out with the downvote button like spoiled infants? This kind of tribal pile-on really pisses me off. You are literally censoring an opinion expressed in good faith - downvotes hide comments and reduce reputation. All while offering no rebuttal, no ideas of your own, nothing. Nice work.

      • Jinn@sh.itjust.works
        link
        fedilink
        arrow-up
        3
        arrow-down
        1
        ·
        9 months ago

        It is what it is. I’ve been involved in Linux communities long enough to know not to take stuff like this personally.

        On Reddit we saw constant posts about why Linux isn’t more popular but no one ever talks about all the dumb little issues that the distros have because of a slight lack of polish. Those little issues make the distros seem cheap compared to the polish of something like Windows.

        I’m always amused at the replies I get with things like “When I had Windows it literally caused my CPU to burst in to flames and my SSD shot my dog. Now I’m running Arch and it showed me last night’s winning lotto numbers.”

        • JubilantJaguar@lemmy.world
          link
          fedilink
          arrow-up
          2
          arrow-down
          1
          ·
          9 months ago

          Ha! Yes I agree completely with all of that.

          And with your point here. In this world of pocket touchscreens and voice AIs, where young people don’t even know what a file is any more, the geeks here are reminding each other to empty their .cache directory from time to time. I mean, do they have no self-awareness? Or perhaps they simply don’t care if nobody chooses to use Linux. That at least would be coherent, but if there are no new users then eventually the whole thing will just die.

          • Zangoose@lemmy.worldOP
            link
            fedilink
            English
            arrow-up
            1
            ·
            edit-2
            9 months ago

            IMO I’d say the same thing about windows’s “Temp” folder though.

            I agree that a lot of Linux isn’t user friendly but I’m also on a distro that is specifically supposed to be customized from the ground up (arch-based) using a tiling window manager which also involves configuring most things from the ground up. This isn’t a problem that most Linux users will likely have, but it is a problem that people may have if they are power users trying to have full control over their system (people who will be on a community about Linux). From what others in this thread have been saying, non-arch distros (and even arch with other aur helpers than yay) tend to have much smaller caches that get up to around 10Gb at most, which is also similar in size to what Windows’s temp directory uses.

            This is a Linux community on a FOSS platform. This community is inherently going to be filled with more “geeky” people. Isn’t this what we signed up for? You make it seem like Linux was ever attracting people who weren’t these type of people to begin with. Computer science is still a growing field, and most sane computer science curriculums involve using POSIX terminal commands and by extension linux at some point. I’m a zoomer and can confirm, we’re not all as hopeless as you think we are. Linux will be fine even ignoring all of its corporate and government backing. And for people who don’t even know what a file is, they probably won’t know what Linux is in the first place. Even if they somehow have a system preconfigured with linux, their Ubuntu or Linux Mint install will probably be clearing the cache for them.

      • the_sisko@startrek.website
        link
        fedilink
        English
        arrow-up
        1
        ·
        edit-2
        9 months ago

        Not a “hater” in terms of trying/wanting to be mean, but I do disagree. I think a lot of people downvoting are frustrated because this attitude takes an issue in one application (yay), for one distro, and says “this is why Linux sucks / can’t be used by normies”. Clearly that’s not true of this specific instance, especially given that yay is basically a developer tool. At best, “this is why yay sucks”. (yay is an AUR helper - a tool to help you compile and install software that’s completely unvetted - see the big red banner. Using the AUR is definitely one of those things that puts you well outside the realm of the “common person” already.)

        Maybe the more charitable interpretation is “these kinds of issues are what common users face”, and that’s a better argument (setting aside the fact that this specific instance isn’t really part of that group). I think most people agree that there are stumbling blocks, and they want things to be easier for new users. But doom-y language like this, without concrete steps or ideas, doesn’t feel particularly helpful. And it can be frustrating – thus the downvotes.