# How can I export all my open Firefox Tabs to a text file?

I've been trying to find a method to export all my currently open tabs in the Android Firefox browser. Unfortunately this seem impossible from default browser installation and very hard to do from command line as the SQLite3 database that Firefox is using, contains too many tables and hard to find the right query.

Apparently this is possible for Google Chrome using THESE hacks.

I would like to have each URL on a separate line in a text file.

Note: this solution requires a rooted Android.

In a terminal emulator app, execute:

(Requires Busybox if running Android 5.1.1 or below. For Marshmallow, remove the term busybox from the following command.)

su
content query --uri content://org.mozilla.firefox.db.tabs/tabs/ --projection url | busybox cut -d '=' f 2 > /sdcard/firefox_tabs.txt


where,

• content query: to query a Content Provider
• org.mozilla.firefox.db.tabs: a content provider from Firefox.
• --projection url: list data from url column only

(Click image to enlarge)

If you've sqlite3 tool in Android, then you can do:

su
sqlite3 /data/data/org.mozilla.firefox/files/mozilla/*.default/browser.db "SELECT url FROM tabs" > /sdcard/firefox_tabs.txt


I've assumed that you've a single Firefox profile and its name has not been altered. If you've a multi-profile setup or if you did change the profile's name, then instead of *.default provide the correct name of the profile of whose tabs' you want in your list.

• Tested on Firefox v45.0.2. – Firelord Apr 27 '16 at 16:55
• Amazing. Worked perfectly! I also learned something new, how to use the content query. – not2qubit Apr 29 '16 at 7:54
• file path might change as of 2018: myphone:/data/user/0/org.mozilla.firefox/files/mozilla/1...f.default – TiloBunt Apr 9 '18 at 5:10

Apparently there is an Android specific Firefox browser plug-in called Tabs Backup. This seem to work like charm! It places a text file in /storage/emulated/0/Android/tabs_backup/ (Aka. /sdcard/Android/tabs_backup/) called backup_DDMMYYY_hhmmss.txt.

However, it would still be interesting to know how to do this from command line.

UPDATE: 2018-08-15

Since some time back, Tabs Backup no longer works for the recent versions of Android Firefox. Instead, use Tabs Export. You also need a separate plugin, to import Tabs.

On Android system you can use Termux (No root required):

1. Navigate in Firefox to URL: file:///data/data/org.mozilla.firefox/files/mozilla/
2. Choose the link of ***.default folder of your profile
3. Choose the sessionstore.js file
4. Copy content of this file and save it in sessionstore.js file on local storage
5. Run the command in Termux to output your tabs urls:

cat ~/storage/shared/sessionstore.js | sed -n 's@{\"url\":\"@&\n@g; s@\",\"title\"@\n@gp' | sed '/^[:{]\"/d'


Or, this command to save your tabs urls in file sessionstore.txt on your local storage:

cat ~/storage/shared/sessionstore.js | sed -n 's@{\"url\":\"@&\n@g; s@\",\"title\"@\n@gp' | sed '/^[:{]\"/d' > ~/storage/shared/sessionstore.txt