this post was submitted on 03 Dec 2023
424 points (96.9% liked)

Linux

48315 readers
836 users here now

From Wikipedia, the free encyclopedia

Linux is a family of open source Unix-like operating systems based on the Linux kernel, an operating system kernel first released on September 17, 1991 by Linus Torvalds. Linux is typically packaged in a Linux distribution (or distro for short).

Distributions include the Linux kernel and supporting system software and libraries, many of which are provided by the GNU Project. Many Linux distributions use the word "Linux" in their name, but the Free Software Foundation uses the name GNU/Linux to emphasize the importance of GNU software, causing some controversy.

Rules

Related Communities

Community icon by Alpár-Etele Méder, licensed under CC BY 3.0

founded 5 years ago
MODERATORS
 

Alt TextA 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

top 50 comments
sorted by: hot top controversial new old
[–] bizdelnick@lemmy.ml 166 points 11 months ago* (last edited 11 months ago) (1 children)

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.

[–] redd@discuss.tchncs.de 25 points 11 months ago (6 children)

So OP's headline should be saying instead: Reminder to CHECK your ~/.cache folder every now and then

[–] cupcakezealot@lemmy.blahaj.zone 18 points 11 months ago (3 children)

just symlink ~/.cache to /dev/null

load more comments (3 replies)
load more comments (5 replies)
[–] nick@midwest.social 81 points 11 months ago

That’s not very cache money of you

[–] ryannathans@aussie.zone 79 points 11 months ago (7 children)

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

[–] lloram239@feddit.de 115 points 11 months ago

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

[–] sebsch@discuss.tchncs.de 50 points 11 months ago (2 children)

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

load more comments (2 replies)
[–] MangoPenguin@lemmy.blahaj.zone 30 points 11 months ago

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

[–] Iapar@feddit.de 25 points 11 months ago

You shouldn't have done that Dave.

load more comments (3 replies)
[–] sebsch@discuss.tchncs.de 41 points 11 months ago (1 children)

Even better: mount ~/.cache as ramfs. It will also speed up some apps significantly.

[–] redd@discuss.tchncs.de 13 points 11 months ago (2 children)

I always felt that there should be some user directory like /tmp/ which will be wiped regularly.

[–] glibg10b@lemmy.ml 10 points 11 months ago

/run/ contains such a directory

load more comments (1 replies)
[–] neonred@lemmy.world 38 points 11 months ago* (last edited 11 months ago) (4 children)

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.

[–] danielquinn@lemmy.ca 11 points 11 months ago

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?

[–] glibg10b@lemmy.ml 8 points 11 months ago (4 children)

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

load more comments (4 replies)
[–] Secret300@sh.itjust.works 7 points 11 months ago

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

load more comments (1 replies)
[–] SuperIce@lemmy.world 34 points 11 months ago (5 children)

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

[–] Zangoose@lemmy.world 29 points 11 months ago (13 children)

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

[–] SuperIce@lemmy.world 21 points 11 months ago (1 children)

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

load more comments (1 replies)
load more comments (12 replies)
load more comments (4 replies)
[–] Pantherina@feddit.de 23 points 11 months ago (1 children)

Your Distro should normally do that for you.

Advising for this means people will delete random cache and download stuff always.

Are multiple files in there? If yes you could add a script that only deletes files of certain age.

load more comments (1 replies)
[–] dog_@lemmy.world 16 points 11 months ago (13 children)

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

[–] skullgiver@popplesburger.hilciferous.nl 41 points 11 months ago* (last edited 11 months ago) (2 children)

[This comment has been deleted by an automated system]

[–] BaroqueInMind@kbin.social 9 points 11 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.

load more comments (1 replies)
load more comments (12 replies)
[–] majestic@sh.itjust.works 16 points 11 months ago

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

[–] noroute@lemmy.world 14 points 11 months ago (1 children)

You can also setup a cron job to periodically clean oldest files for you.

Example: @weekly find ~/.cache -type f -mtime +7 -delete

This will delete everything older than 7 days inside your cache folder.

load more comments (1 replies)
[–] conorab@lemmy.conorab.com 12 points 11 months ago (2 children)

Doesn’t Steam store the game library there?

[–] Zangoose@lemmy.world 11 points 11 months ago (1 children)

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

load more comments (1 replies)
[–] CheesyFox@lemmy.world 11 points 11 months ago (1 children)
load more comments (1 replies)
[–] vox@sopuli.xyz 10 points 11 months ago* (last edited 11 months ago)

seems like a bug in one of rhe programs you're using.
modt software automatically manages it's cache...
are you using build caching tools such as Mozilla sccache? These tend to create 20gb+ cache directories, especially if used with debug builds

[–] ArcaneSlime@lemmy.dbzer0.com 9 points 11 months ago* (last edited 11 months ago) (3 children)

....yeah let me go check that...

13,574 totaling 1.7gb, not too bad. Hey OP how do you get to this view? It looks like we both use nautilus but when I select "properties" on the .cache folder it looks different.

load more comments (3 replies)
[–] sunred@discuss.tchncs.de 7 points 11 months ago (1 children)

du -sh ~/.cache/* | sort -h

load more comments (1 replies)
load more comments
view more: next ›