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

167 points
*

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.

permalink
report
reply
25 points

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

permalink
report
parent
reply
18 points

just symlink ~/.cache to /dev/null

permalink
report
parent
reply
5 points

Lmao some malicious ass advise here

permalink
report
parent
reply
3 points

Cache exists for a reason, that sounds like itd break programs, a safer method is probably having it be a ramdisk

permalink
report
parent
reply
1 point

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 ~ and var. 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).

permalink
report
parent
reply
7 points
*

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.

permalink
report
parent
reply
83 points

That’s not very cache money of you

permalink
report
reply
80 points

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

permalink
report
reply
116 points

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

permalink
report
parent
reply
51 points

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

permalink
report
parent
reply
3 points

not necessarily during runtime

permalink
report
parent
reply
2 points

But a restart of an app should fix it.

permalink
report
parent
reply
30 points

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

permalink
report
parent
reply
25 points

You shouldn’t have done that Dave.

permalink
report
parent
reply
4 points

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

permalink
report
parent
reply
9 points

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

permalink
report
parent
reply
3 points

The contents were deleted

permalink
report
parent
reply
41 points

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

permalink
report
reply
13 points

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

permalink
report
parent
reply
10 points

/run/ contains such a directory

permalink
report
parent
reply
-1 points
*

/tmp and /var/tmp are writable to regular users on most distributions

permalink
report
parent
reply
38 points
*

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.

permalink
report
reply
11 points

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?

permalink
report
parent
reply
8 points

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

permalink
report
parent
reply
4 points

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

permalink
report
parent
reply
3 points

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

permalink
report
parent
reply
7 points

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

permalink
report
parent
reply
1 point

Thats not very secure. /tmp/ is usually 777

permalink
report
parent
reply

Linux

!linux@lemmy.ml

Create post

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

Community stats

  • 7.7K

    Monthly active users

  • 6.5K

    Posts

  • 179K

    Comments