9

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?

Byte Commander
  • 107,489

1 Answers1

6

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 file apthistory.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 file user. 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.

Nephente
  • 5,595
  • 1
  • 17
  • 23