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
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.
So OP’s headline should be saying instead:
Reminder to CHECK your ~/.cache folder every now and then
just symlink ~/.cache to /dev/null
Lmao some malicious ass advise here
Cache exists for a reason, that sounds like itd break programs, a safer method is probably having it be a ramdisk
Check? Why?
% du -sh ~/.cache 1,6G /home/bizdelnick/.cache
I don’t remember if I ever cleaned it up. Probably a couple years ago when I moved my old HDD to new PC with freshly installed OS. It does not grow accidentally. Only in some very rare cases. As well as some other dirs under
~
andvar
. If it is a critical system, set up monitoring of free filesystem space. If not, you will notice if it becomes full (I can’t remember when this happened to me last time, maybe ~15 years ago when some log file started to grow because of endless error messages).Because some users experienced accidential grows like OP had 160 Gbyte. So general advice for linux users can be stated as: Check your ~/.cache every now and then
Critical systems/servers shall better be monitored as you suggest.
Some users experienced accidential growth of /var/log. Some users experienced accidential growth of /var/cache. Some users experienced accidential growth of /var/lib. Some users experienced accidential growth of ~/.xsession-errors. Shall I continue?
Does every user need to begin his day checking all that places? No, he does not. It is waste of time. Such situations are extremely rare. If you are paranoid, check
df
to see if you have enough free space, and only if it unpredictably shrinked begin to ivestigate which directory has grown.I don’t get your point. Why should somebody do this every day?
As the experience from other users in this thread, it seems not extremely rare to have an overgrown ~/.cache/ folder. So checking it from time to time is a good advice. If we all do this for a time, and create bug tickets for software which is not cleaning up. Then this problem will hopefully go away with future software releases.
Why should somebody do this every day?
Why should somebody do this ever?
As the experience from other users in this thread, it seems not extremely rare to have an overgrown ~/.cache/ folder.
It is the first thread about overgrown
~/.cache
directory I see since I use Linux (~16 years or so). But, as I wrote above, this sometimes (rarely) happens with log files and some other directories. Checking each of them is a waste of time, if not automated, checking just one or few of them makes sense only if you are testing some app and looking for files it creates.
du -sh ~/.cache/* | sort -h
ncdu ~/.cache/
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.
So the apps are broken. Cache is meant to be deleted at any time
not necessarily during runtime
But a restart of an app should fix it.
For some reason devs can’t wrap their head around cache being temporary.
You shouldn’t have done that Dave.
Cannot this be caused by deleting the folder and not just everything inside?
The contents were deleted
It’s likely. mkdir fails to create a subdirectory such as ~/.cache/mozilla/ if ~/.cache/ doesn’t exist, unless
-p
is explicitly passed to mkdirOf course, not everything is a shell script, but I imagine the directory creation functions in many languages work similarly
NEVER
That’s not very cache money of you
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
/tmp and /var/tmp are writable to regular users on most distributions
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 buildsYour 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.
I’m not aware of any distro that automatically clears a user’s .cache in their home directories. Maybe you’re thinking of /var/cache?
I just map both the user cache and the /tmp directory to a RAM drive. I allocated 4 GB but in practice it never gets even close to that much, and Linux seems to not be reserving the entire 4 GB at boot so I would assume how much RAM is used depends on how much is actually in your cache.
It also defers cache and tempfile related problems to turning it off and on again.
Bleachbit is good for clearing up some space
And deleting emails
Even Hillery knows that one.
Come on!
/s
…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.
the screenshot does not look like nautilus, maybe xfce?
Is it safe to clear
~/.cache/mozilla/
while Firefox is running?No.
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.
deleted by creator
I’ve been running Linux as my primary OS since the late 90s and have never run into this problem.
Yes because other operating systems never have any small annoying issues.
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.”
This is why Linux sucks!
Windows famously never generates any garbage files. It’s so reliable all servers run windows. Right?