neonred, (edited )

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.

library_napper,
@library_napper@monyet.cc avatar

Thats not very secure. /tmp/ is usually 777

danielquinn,
@danielquinn@lemmy.ca avatar

Isn’t most of what’s in there just filters downloaded from the internet? Python packages, browser cache, etc? Your system confirms you to redownloading everything all the time, no?

Secret300,

Once I get more than 16GB of ram I’ll definitely try that

glibg10b,

This seems like a filename conflict waiting to happen. Why not just mount a tmpfs there?

neonred,

Like I said it’s a cheap solution for a single user system. Ofc tmpfs would be better but has to be done for every user again

glibg10b,

You: It’s a single user system
Also you: Tmpfs would have to be done for every user

And a /tmp/ symlink would have to be created for every user too, so I don’t get your point

Tmpfs is just as easy as making a symlink, but without the filename conflicts between files in ~/.config/ and /tmp/. You just need to add a line to /etc/fstab

tslnox,

/usr/local/sbin/adduser.local

One line in there and you can make it add a new line with appropriate /home/userX/.cache tmpfs line to fstab.

Or, maybe a cleaner way, you might make a init/systemd service that, when booting, would run something like

for each dir in /home do
mount dir/.tmp -type tmpfs
done

I’m not at the computer now and I’m lazy to Google it, so this above is just a pseudo code and probably won’t run.

glibg10b, (edited )

Neat, thanks for sharing

Here’s the above pseudocode in bash:


<span style="color:#323232;">find /home/ -mindepth 1 -maxdepth 1 -type d -exec mount none {}/.cache/ -t tmpfs -o size=16G </span><span style="color:#0086b3;">;
</span>

for doesn’t work here because it uses spaces to delimit strings, which could cause issues with filenames that contain spaces

You can also create a systemd user service, which is useful if you don’t have root access. The above mount command requires root, but the following doesn’t and is more robust than symlinking to /tmp/:


<span style="color:#323232;">ln -s $(mktemp -dp /var/tmp/) ~/.config/
</span>
ryannathans,

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

Iapar,

You shouldn’t have done that Dave.

lloram239,

Time to write some bug reports. ~/.cache is supposed to be disposable.

sebsch,

So the apps are broken. Cache is meant to be deleted at any time

redd,
@redd@discuss.tchncs.de avatar

not necessarily during runtime

30p87,

But a restart of an app should fix it.

MangoPenguin,
@MangoPenguin@lemmy.blahaj.zone avatar

For some reason devs can’t wrap their head around cache being temporary.

stepanzak,

Cannot this be caused by deleting the folder and not just everything inside?

glibg10b,

It’s likely. mkdir fails to create a subdirectory such as ~/.cache/mozilla/ if ~/.cache/ doesn’t exist, unless -p is explicitly passed to mkdir

Of course, not everything is a shell script, but I imagine the directory creation functions in many languages work similarly

ryannathans,

The contents were deleted

conorab,

Doesn’t Steam store the game library there?

Zangoose,

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,

Yep my bad! I mis-remembered .local/share/steam as . cache/share/steam. :)

CheesyFox,

it stores it in ~/.steam

conorab,

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! :)

SuperIce,

I don’t think I’ve ever seen .cache get bigger than 10GB

SkyeStarfall,

Depends on the distributions and default settings. In arch, by default, pacman doesn’t delete cache.

SuperIce,

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.

JustTesting,

You can set a hook to do it automatically or use this, but I agree that this should be default behaviour

SuperIce,

You can also just do systemctl enable paccache.timer to automatically run paccache once a week.

Zangoose,

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

bizdelnick,

If it is true, it is a bug in yay. Cashe should not grow without limit.

bizdelnick,

It was reported twice as minimum. Seems that author does not care.

SuperIce,

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).

30p87,

One would just need to modify the pacman cache hook for yay. I’m too lazy tho.

MonkderZweite,

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

kattenluik,

You should try using paru, might be better off with it.

stepanzak,

Paru cache is huge and you have to delete it manually with something like paru -Sc i think

brakenium,

My update script handles mirrors, updates and cleans the cache automatically. I’d definitely recommend creating one. It’s aliased to sysupdate for me and I also check if it’s a debian or arch based distro so the command works on my servers and desktop

BaroqueInMind,
BaroqueInMind avatar

What is your update script? Where did you post it?

brakenium,

I don’t think I’ve posted it before, but here it is. If you use different utilities you’d have to swap those out. Also excuse the comments, I had GH Copilot generate this script

stepanzak,

I highly recommend topgrade. You can add custom commands so clearing paru’s cache shouldn’t be a problem. I just do it by hand as I’m ok with it.

brakenium,

I’ve heard of tools like that, but this works fine for me. This way I’m not dependent on it being packaged for my distro and having to install it through other means. I’m fine running things manually, this is just for convenience

EddyBot,

it doesn’t matter if you use paru, yay or heck makepkg if you are compiling packages with hilariously large sources like for example webbrowser (librewolf, brave, ungoogled-chromium, firedragon take each like ~30 GB) without pruning the build cache afterwards

Zangoose,

Something I noticed was that in this case it was mostly binary AUR programs taking up the space.

I think maybe since yay/AUR use cloned git repos, and old versions of binaries get stored in the git diff and then add up because different versions of the binary are basically like keeping multiple copies of it instead of just the changes to the source code.

Jinn,

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.

TheWoozy,

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

NegativeLookBehind,
NegativeLookBehind avatar

Yes because other operating systems never have any small annoying issues.

Jinn,

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.”

atzanteol,

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

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

ik5pvx,

And don’t forget to defrag, while you are at it.

kariboka,

Windows auto defrag now though. Dont hate me I love my Linux.

kglitch,

Have you checked your C:\windows\temp folder lately?

fluffyb,

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”

d3Xt3r,

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.

Infiltrated_ad8271,
Infiltrated_ad8271 avatar

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

d3Xt3r,

If you’re talking about the Storage Sense feature - it sucks. It only clears a handful of well-known locations, but it doesn’t touch any of the orphaned content in C:\Windows\Installer, or the CSC or the old Panther folders from upgrades, not to mention several other files and folders in AppData. As I’ve said before, I’ve been a Windows sysadmin (until last year infact) managing over 20,000 devices, we’ve had Storage Sense on, but it’s been mostly useless - to the point that I ended up writing own cleanup script and set it to run before we pushed out a new Windows feature update, because otherwise we’d get several devices which failed to update due to the disk being full.

Infiltrated_ad8271,
Infiltrated_ad8271 avatar

I think it's that one. I certainly won't say it's a panacea, but I assume it would have solved the OP's case.

Astaroth,

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…

SuperIce,

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.

Zangoose,

It ended up being yay storing binaries from previous versions of AUR packages, definitely depends on the distro/usage but for arch-based it definitely clears up a lot of storage

UndercoverUlrikHD,

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.

JubilantJaguar,

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,

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,

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.

the_sisko,

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.

JubilantJaguar, (edited )

Fair enough, tho personally I don’t see this “doom-y language” you see, I just see a slightly exasperated opinion expressed in good grammar and good faith.

But personally I don’t downvote people for their opinions, ever, as a matter of principle. It’s literally a form of censorship, given that it hides the comments. It leads straight to a deadening groupthink where dissenters are scared to open their virtual mouths. It creates a general aura of negativity and intolerance that helps nobody at all. Downvoting, as it is used by most people here and on the R-site, is an absolute scourge. If anything makes me leave this community, it will be this.

ProtonBadger,

Well, they're an Arch Linux user which is a special case. On Arch and derivatives it's the user's responsibility to manage the system so this doesn't happen, configure cleanup daemons, flush package managers, etc., alternatively it could also be a misbehaving application which would have to be reported. Arch is for hobbyists who likes to do this.

On other Linux distributions, Windows or macOS if this happens it's usually an application not properly managing its cache.

lemmy_user_838586,

deleted_by_author

  • Loading...
  • cmnybo,

    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,

    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,
    @aleq@lemmy.world avatar

    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.

    nick,

    That’s not very cache money of you

    just_another_person,

    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.

    elbarto777,

    How?

    just_another_person,

    Depends on the package manager. Check options for whatever you’re running.

    ryannathans,

    Can hurt to clear, there’s a lot more than just package managers using it

    just_another_person,

    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,

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

    just_another_person,

    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.

    bizdelnick,

    Ah, sorry, I thought about system package managers like apt, dnf, zypper etc.

    dog_,

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

    cmnybo,

    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.

    bizdelnick,

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

    sebsch,

    Just mount it into your RAM

    skullgiver, (edited )
    @skullgiver@popplesburger.hilciferous.nl avatar

    deleted_by_author

  • Loading...
  • BaroqueInMind,
    BaroqueInMind avatar

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

    Zangoose,

    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!

  • All
  • Subscribed
  • Moderated
  • Favorites
  • linux@lemmy.ml
  • DreamBathrooms
  • mdbf
  • ethstaker
  • magazineikmin
  • cubers
  • rosin
  • thenastyranch
  • Youngstown
  • osvaldo12
  • slotface
  • khanakhh
  • kavyap
  • InstantRegret
  • Durango
  • JUstTest
  • everett
  • tacticalgear
  • modclub
  • anitta
  • cisconetworking
  • tester
  • ngwrru68w68
  • GTA5RPClips
  • normalnudes
  • megavids
  • Leos
  • provamag3
  • lostlight
  • All magazines