Ubuntu tweak and Mozilla (firefox and thunderbird) cache

I usually use Ubuntu tweak to do cleanup jobs on my PC. This includes apt and program cached data and old kernels. This goes alright for most programs except Mozilla based application - Firefox and Thunderbird.

Ubuntu tweak doesn't seem to know where their cache folders are and always returns 'zero packages can be cleaned' even when the cache folder is full. Check screenshot below:

I am looking for a way to clean up ALL my cache data and unneeded packages at one point.

If someone knows how to change the ubuntu tweak cache folders for Firefox and Thunderbird, that would be perfect.

I tried bleachbit last but it crashed my PC to a point I had to re-install Ubuntu.
I am using Ubuntu tweak 0.8.6.

EDIT
Same issue with the screenshot of this question: Why isn't Ubuntu Tweak's Janitor working?

EDIT 2
For the python programmers out there, this answer shows the commands that Ubuntu tweak janitor runs to clean up the system. Maybe something in there will shed more light to this issue.

Asked By: Parto
||

Answer #1:

As I tested Ubuntu Tweak 0.8.6 in Ubuntu 13.10. It seems that for both, late releases of Mozilla Firefox and Thunderbird moved their cache folders to ~/.cache. Profiles configuration kept in same place ~/.mozilla/firefox/profiles.ini and ~/.thunderbird/profiles.ini.

  • Firefox: ~/.mozilla/firefox/~/.cache/mozilla/firefox/

  • Thunderbird: ~/.thunderbird/~/.cache/thunderbird/

Quick patch:

sudo nano /usr/share/pyshared/ubuntutweak/janitor/mozilla_plugin.py

Add/Change all lines I include cache_path in them (3 new lines, 2 modified app_pathcache_path, keep app_path of the profiles.ini):

import os
import logging

from ubuntutweak.janitor import JanitorCachePlugin
from ubuntutweak.settings.configsettings import RawConfigSetting

log = logging.getLogger('MozillaCachePlugin')

class MozillaCachePlugin(JanitorCachePlugin):
    __category__ = 'application'

    targets = ['Cache',
               'OfflineCache']
    app_path = ''
    cache_path = ''

    @classmethod
    def get_path(cls):
        profiles_path = os.path.expanduser('%s/profiles.ini' % cls.app_path)
        if os.path.exists(profiles_path):
            config = RawConfigSetting(profiles_path)
            try:
                profile_id = config.get_value('General', 'StartWithLastProfile')
                for section in config.sections():
                    if section.startswith('Profile'):
                        relative_id = config.get_value(section, 'IsRelative')
                        if relative_id == profile_id:
                            return os.path.expanduser('%s/%s' % (cls.cache_path, config.get_value(section, 'Path')))
            except Exception, e:
                log.error(e)
                path = config.get_value('Profile0', 'Path')
                if path:
                    return os.path.expanduser('%s/%s' % (cls.cache_path, path))
        return cls.root_path


class FirefoxCachePlugin(MozillaCachePlugin):
    __title__ = _('Firefox Cache')

    app_path = '~/.mozilla/firefox'
    cache_path = '~/.cache/mozilla/firefox'

class ThunderbirdCachePlugin(MozillaCachePlugin):
    __title__ = _('Thunderbird Cache')

    cache_path = '~/.cache/thunderbird'
    app_path = '~/.thunderbird'

I filled an upstream bug report for this, See Cache path of Mozilla Firefox and Thunderbird changed to ~/.cache #24

Answered By: user.dz

Answer #2:

For firefox you could install firebug. Once firebug is installed into firefox you can do a:

ctrl shift del

This will bring up the clear history dialog which includes clearing cache. Giving you nice control over what you clear and what you don't. Here is a screenshot of the feature:

Answered By: Jeff Sheffield
The answers/resolutions are collected from stackoverflow, are licensed under cc by-sa 2.5 , cc by-sa 3.0 and cc by-sa 4.0 .



# More Articles