13

Is there an easy way to backup Firefox bookmarks to a file with command line. Running a find command, I managed to find this file: /.mozilla/firefox/9a5j5dbb.default/bookmarkbackups/bookmarks-2013-05-22.json which appears to have my latest data. However, I dont know if the folder under Firefox (currently 9a5j5dbb.default) will keep changing, and I'm pretty sure the date will.

Rather than a more advanced shell script to dynamically calculate the path based on today's date and looking for the only xxxxx.default folder under ~/.mozilla.

Is there a simpler/more-robust way to save/copy your current Firefox bookmarks to a specified file?

Programster
  • 6,039

4 Answers4

16

Using sqlite:

Firefox uses sqlite to store its data. Bookmarks are stored in ~/.mozilla/firefox/profile_name/places.sqlite. So we can use sqlite to backup and restore Firefox bookmarks.

Hit Ctrl+Alt+T to open terminal and run following command to install sqlite3:

apt-get install sqlite3

Now you can one following command to backup/restore Firefox bookmarks, make sure to close Firefox before running any of following commands.

Backup:

sqlite3 ~/.mozilla/firefox/user.profile/places.sqlite ".backup /path/to/directory"

Restore:

sqlite3 ~/.mozilla/firefox/user.profile/places.sqlite ".restore /path/to/backup/file"

Change user.profile with your default profile name.

Simple Backup:

If you don't want to install any additional packages use following command to copy latest bookmarks backup from Firefox profile:

cp $(find ~/.mozilla/firefox/fvy8ug06.default/bookmarkbackups | sort | tail -n1) .
10

Well since there is only one .default in that folder you could use a wildcard like this:

*.default

sudo cp -fr /Path/to/Source/Folder/*.default /Path/to/Destination/Folder

Meintjes
  • 2,450
3
  • Working solution as of 30/10/2022

Set browser.bookmarks.autoExportHTML to true in about:config or user.js. This will generate a bookmarks.html file in your Firefox profiles' root directory eg. /home/snowman/.mozilla/firefox/0uffvdebh.default whenever the browser is closed.

See the Mozilla Support page for more information. Export all the bookmarks from a loads of profiles from a script

This file can be copied and imported as expected.

rial
  • 131
-3

In mozilla there is a option for taking the Backup of Bookmarks in JSON format.

You can follow these steps:-

  1. open all bookmarks (shift+ctrl+o)

  2. select 'Import and Backup' option (alt+i)

  3. Select 'Backup' option

here you can get all bookmark backup in json format.