Where does Firefox store its cookies on Linux?

Firefox stores cookies in sqlite database ~/.mozilla/firefox/<profile path>/cookies.sqlite. You can have full access to it.

For example, to watch all cookies from stackoverflow.com you can do:

cd  ~/.mozilla/firefox/<profile path>/
sqlite3 cookies.sqlite
select * from moz_cookies where baseDomain glob '*stackoverflow*'

(replace here <profile path> by path of your firefox profile).

To see names of database fields do: .schema.


Those answers are outdated in 2020 or at least it didn't work for me on OpenSUSE leap 15.2 Firefox 78.2

I followed the top rated answer with some tweaks found from googling so:

cd ~/.mozilla/firefox/<random string profile path>/

It seems that Mozilla has locked the database so you'll need to copy it

cp cookies.sqlite cooking.sqlite

Then you can do

sqlite3 cooking.sqlite

To list all the different tables if you need to sort by something other then domain

PRAGMA table_info(moz_cookies);

I get all those tables (note that baseDomain isn't there)

id| originAttributes | name| value| host | path | expiry | lastAccessed | creationTime | isSecure | isHttpOnly | inBrowserElement | sameSite | rawSameSite

SELECT * FROM moz_cookies WHERE host GLOB 'domain';

or

SELECT value FROM moz_cookies WHERE host GLOB 'domain';


Although this listed all my stored cookies I was not able to see "temporary" cookies, I confirmed it by running:

SELECT id FROM moz_cookies;

This gives me a list of 8 ID and if I go to Preference>security>manage data it list only 8

This shows how glob works because the answer wasn't really clear on that https://www.sqlitetutorial.net/sqlite-glob/

This is where I got the idea of just copying the cookie database, Note that the file needs to end with sqlite https://stackoverflow.com/questions/4706537/firefox-locks-places-sqlite

Tags:

Firefox