I want to clear my firefox cache and cookies from terminal.
What can i do?

  • I just tried deleting everything from the preferences menu, and it deleted web content cache, you just have to choose everything, close the windows. Once open again the cache was 0. – Mitch Oct 30 '13 at 7:50

To clean the cookies from terminal you can use the following command:

rm ~/.mozilla/firefox/*.default/cookies.sqlite

To clean all the cache, you can use:

rm ~/.mozilla/firefox/*.default/*.sqlite ~/.mozilla/firefox/*default/sessionstore.js
rm -r ~/.cache/mozilla/firefox/*.default/*

But, better you can make a backup of these files if you want to restore them latter:

mkdir -p ~/.mozilla/firefox/backup ~/.cache/mozilla/firefox/backup
mv ~/.mozilla/firefox/*.default/*.sqlite  ~/.mozilla/firefox/backup
mv ~/.mozilla/firefox/*.default/sessionstore.js ~/.mozilla/firefox/backup
mv ~/.cache/mozilla/firefox/*.default/* ~/.cache/mozilla/firefox/backup
| improve this answer | |
  • 1
    It clears all my browser's history,weblogins etc.But it still shows your web content cache is currently using 30 MB of disk space under Network Tab after restarting the browser. – Avinash Raj Oct 30 '13 at 7:20
  • 1
    @AvinashRaj Ah, sorry, see my new edits. – Radu Rădeanu Oct 30 '13 at 7:32
  • rm -r ~/.cache/mozilla/firefox/*.default/* command shows no such file or directory.There was no mozilla folder inside .cache directory. – Avinash Raj Oct 30 '13 at 7:43
  • @AvinashRaj Probably you deleted already. – Radu Rădeanu Oct 30 '13 at 7:45
  • In Mint Mate the command differ a little bit: mkdir -p ~/.mozilla/firefox/backup ~/.cache/mozilla/firefox/backup <br> mv ~/.mozilla/firefox/*.default*/*.sqlite ~/.mozilla/firefox/backup <p> mv ~/.mozilla/firefox/*.default*/sessionstore.jsonlz4 ~/.mozilla/firefox/backup <p> mv ~/.cache/mozilla/firefox/*.default*/* ~/.cache/mozilla/firefox/backup<p> – Peterling May 7 '18 at 19:21

I would like to weigh in on this issue. I have set Firefox to automatically clear all cache, cookies, etc., when I quit.

Firefox menu: Edit > Preferences > Privacy

History: Select "Use Custom Settings for History"

  • All items are checked
  • Always accept all cookies, but keep until I close Firefox
  • Clear history when FF closes: Settings: Everything is checked except Delete Saved Passwords.

If I want to clear the history, etc. while Firefox is running, I simply hit Ctrl-Shift-Delete and choose what to delete.

If Firefox is NOT running, then there is no need to run the script, as the offending stuff has already been deleted. ALMOST. Turns out all of the thumbnails are still resident in ~/.cache/thumbnails/normal and ~/.cache/thumbnails/fail. For these, I wrote a little script:

echo "shredding cache"
find ~/.cache/thumbnails -type f -name "*.png" -exec shred -f -u -z -n 1 {} \;
echo "finished shredding"

* I fire that on a cronjob, every 3 hours.

But an even simpler way is to run bleachbit. Just as fast to click bleachbit off the menu as it is to open a terminal and run a script. For me, anyway.

Good luck!

| improve this answer | |

I at least found a proper solution:

first go to your home location

press ctrl+h

open folder .cache

open folder mozilla

open folder firefox

open the (anything).default folder

open the cache folder

delete all folders in this

then open Firefox

go to edit, preferences and delete all cache and cookies once

and i assure u the your problem will be solved

| improve this answer | |
  • 3
    OP wants to use the terminal and not a file manager. So your answer doesn't apply. – user25656 Jan 14 '14 at 18:05

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.