Thursday, October 31, 2013

Where is Mozilla Firefox Cache

This one is not about programming. Mozilla Firefox is popular web browser and it comes as default browser on many Linux distros. OK it may be called Iceweasel instead of Firefox, but that is about the same. Cache used to be in $HOME/.mozilla/firefox/(profile)/Cache but now it is not there. During the time one get used to delete or copy files from cache to some safe location, for example:

find (path to Cache) -type f -size +100k -exec cp --parents {} (where to copy) \;

But now cache is gone and nothing works. Initial reaction is google for solution, we are turning into web search addicts, and when that doesn’t bring us joy we are searching some more.
So, how we find cache? For the beginning we start Firefox and terminal. In terminal we execute:

ps aux | grep firefox

That will tell us what is process ID for Firefox. Should look something like this:

(user name)   16025 19.6  5.9 1065852 226284 ?      Sl   16:10   0:13 /usr/lib/firefox/firefox

That 16025 is process ID or pid. Knowing pid we can easily find out what files that proces is keeping open:

ls -l /proc/16025/fd | grep cache

We execute that in terminal, no need to be root. On Mint it is in $HOME/.cache/mozilla/firefox/(profile).
That was so simple, how is possible that I couldn’t find it on Google ;-)