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?
11 Answer
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.pwith 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$USERbut 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.