Where does Firefox store cookies in Linux?
I searched everywhere but did not find anything.
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
Since you didn't specify if you were looking for that storage outside or inside of Firefox, another really good way to access and edit cookies comes from the Web Developer | Storage Inspector:
You can add, remove, and edit cookies for a given web site.
If you need a text file with the cookie information, you can dump all your cookies using different add-ons.
When I needed cookies for downloading using wget, I dumped using Export Cookies and then loaded them in wget using wget --load-cookies <cookiefile>
If you want to know what path firefox is using for your current profile you can check this with about:profiles or about:support in the url bar.
No matter how Firefox is installed, via a package manager, Snap, Flatpak, or otherwise, or where the profile is stored, this will always show the correct profile path.
In recent versions of Firefox, the cookie storage location in Linux has been changed.
The cookies are stored in a format called cookies.sqlite within the Firefox profile directory.
Check this too, for other or experimental technology:
There are other storage mechanisms for cookies in recent versions, such as IndexedDB and the HTTP cookies storage API. Check the Browser compatibility table carefully before using this in production.
You can use the Storage Inspector to inspect the cookies and other types of storage used by the current tab.
The Storage Inspector enables you to inspect various types of storage that a web page can use. Currently it can be used to inspect the following storage types:
Cache Storage — any DOM caches created using the Cache API.
Cookies — All the cookies created by the page or any iframes inside of the page. Cookies created as a part of response of network calls are also listed, but only for calls that happened while the tool is open.
IndexedDB — All IndexedDB databases created by the page or any iframes inside the page, their Object Stores and the items stored in these Object Stores.
Local Storage — All local storage items created by the page or any iframes inside the page.
Session Storage — All session storage items created by the page or any iframes inside the page.
Others have provided great detail. I would just like to add to the discussion that you can search through your cookies (and optionally remove them) by going into "Open Menu">Preferences>Privacy>"remove individual cookies" link.
For all intensive purposes, using the sqlite method provided to browse through the cookies database is of course far superior, as it is a database and you can use SQL statements on the data.