Purpose of '~/.cache' directory and when is it safe to delete?
This is by no means a definite answer.
According to the XDG Base Directory Specification, $XDG_CACHE_HOME
which defaults to $HOME/.cache
holds
[...]user-specific non-essential (cached) data[...]
It is however not specified what constitutes 'non-essential data'. Furthermore an application might not play by freedesktop rules and put whatever it wants in .cache
.
Browsing through my cache folder, I find things like
- Browser caches. Safe enough to delete.
- Thumbnails. Will be recreated if deleted.
-
software-center
. Wasn't sure about that. Contains a fileapthistory.p
with your - well - history of apt. Moved it out of the way and it was recreated on the next start of the Ubuntu Software Center. - I guess the Software Updater stores package lists
apt-file
. Will be downloaded anew if deleted. - icon-cache. Like thumbs, will also be recreated.
-
compizconfig-1
. Contains binary files; compiz seems to cache its configuration in optimized form from~/.config/compizconfig-1
. -
dconf
. This directory actually doesn't belong to$USER
but root. Mine contains a single non plaintext fileuser
. Since you can't delete it anyway without sudoing... No problem. - And some more directories which I don't deem critical.
In summary, I believe it perfectly safe to empty the cache folder. In fact I do this from time to time and never experienced faulty behaviour afterwards.
This is not a guarantee though, just my two cents and a (somewhat) educated guess.
Related videos on Youtube
Byte Commander
Ask Ubuntu moderator♦, IT student and DevOps engineer. I love Ubuntu, Python, good music and coffee, although not necessarily in that order. You can easily contact me in the Ask Ubuntu General Room most of the time, or on Discord as @ByteCommander#2800. I'd also love to invite you to my Ubuntu Hideout Discord Server btw. PS: My profile picture is derived from "Wolf Tribals" by user HaskDitex (DeviantArt.com), which is under creative Commons 3.0 License. Currently I'm using the character "Dregg Morriss" from the game "Medieval Cop" by Vasant Jahav ("Gemini Gamer"). It can be found here.
Updated on September 18, 2022Comments
-
Byte Commander over 1 year
What is the purpose of every user's
~/.cache
directory?Under which circumstances can it be deleted, when should one be careful about its contents?
-
Admin over 8 yearsSee the link I gave you
-