Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

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?

share|improve this question
The folder named 9a5j5dbb.default is the Profile Folder of your Firefox. It won't change unless you re-install Firefox/Ubuntu. If you delete this folder, Firefox would create another randomly-generated-named folder for your Profile. –  Aditya May 23 '13 at 14:09

3 Answers 3

up vote 3 down vote accepted

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


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

share|improve this answer
This seems like the most appropriate answer so far because I can run it from the shell. I guess I just have to use this and pick the alphanumeric .json file to get the latest one. I was rather hoping I could run something like firefox --dump-bookmarks /my/folder/loc/bookmarks.json –  Programster May 23 '13 at 15:00
It's not necesary to use sudo as the profile folder is in $HOME. If sudo is used to make the copy, root will own the copied files, unless you of course used the -a switch with cp to preserve ownership. –  user76204 May 30 '13 at 22:39

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.

share|improve this answer
-1 That's not from command line –  user2529583 Jun 15 at 19:17

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.


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


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) .
share|improve this answer
Whilst this is probably the most 'proper' way to do things in the command shell, I still prefer Mr Seeds solution for 3 main reasons: 1) This rquired me to install sqlite3 2) This saved in a non-human readable format rather than the json format fo the other solution 3) This command was far less 'flexible' and I had to plug in an absolute path name for sqlite to work. Something like ~/data did not work. However, thank you for your input, and perhaps others will prefer to use this solution. –  Programster May 24 '13 at 12:00

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.