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

- 78,556
-
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 07:50
4 Answers
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

- 169,590
-
1It 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 07:20 -
1
-
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 07:43 -
-
In Mint Mate the command differ a little bit: mkdir -p ~/.mozilla/firefox/backup ~/.cache/mozilla/firefox/backup
mv ~/.mozilla/firefox/.default/.sqlite ~/.mozilla/firefox/backup
.default/sessionstore.jsonlz4 ~/.mozilla/firefox/backup
mv ~/.mozilla/firefox/
.default/ ~/.cache/mozilla/firefox/backup – Peterling May 07 '18 at 19:21
mv ~/.cache/mozilla/firefox/
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 the thumbnails are still resident in ~/.cache/thumbnails/normal
and ~/.cache/thumbnails/fail
. For these, I wrote a little script:
#!/bin/bash
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!

- 15,657

- 341
- 1
- 4
- 7
The proper way of clearing the Firefox's cache (execute as a user, not root):
$ rm -rf ~/.cache/mozilla/firefox/????????.*/cache2/*
The proper way of clearing the Firefox's cookies (execute as a user, not root):
$ rm ~/.mozilla/firefox/????????.*/cookies.sqlite
Works for both Debian and Ubuntu.
Works for multiple Firefox user profiles.

- 101
- 1
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

- 15,657
-
6OP wants to use the terminal and not a file manager. So your answer doesn't apply. – Jan 14 '14 at 18:05