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.
Linux
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
- Posts must be relevant to operating systems running the Linux kernel. GNU/Linux or otherwise.
- No misinformation
- No NSFW content
- No hate speech, bigotry, etc
Related Communities
Community icon by Alpár-Etele Méder, licensed under CC BY 3.0
So OP's headline should be saying instead: Reminder to CHECK your ~/.cache folder every now and then
That’s not very cache money of you
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
Time to write some bug reports. ~/.cache is supposed to be disposable.
For some reason devs can't wrap their head around cache being temporary.
You shouldn't have done that Dave.
Even better: mount ~/.cache as ramfs. It will also speed up some apps significantly.
I always felt that there should be some user directory like /tmp/
which will be wiped regularly.
/run/ contains such a directory
I don't think I've ever seen .cache get bigger than 10GB
It looks like yay was storing AUR build files there, that folder took up about 160 of the 164GiB
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
).
Depends on the distributions and default settings. In arch, by default, pacman doesn't delete cache.
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.
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.
No way. If i clean up my .cache directory my precious cached with sccache rust deps would be very upset. >:[
Question, could you have cron/crontab do it monthly or something? Do it monthly meaning delete everything in ~/.cache every month or so?
[This comment has been deleted by an automated system]
This is the good shit I miss from reddit. Thank you for posting a systemd service config, I'm going to implement this.
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!
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.
Doesn’t Steam store the game library there?
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
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
....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.
NEVER
Check which folder is the biggest. I am going to go on a lim and say it probably is being caused by file roller
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
yay -Sc(c)
Is probably a better command in this instance
Bleachbit is good for clearing up some space