I am migrating from Windows to Ubuntu for my personal desktop and I want to know an easy way to backup personal data such as Firefox bookmarks, personal documents, etc...

In Windows I am copying everything manually and in Ubuntu I want to create a bash script to do it automatically.

I have no knowledge of bash scripting other than creating a file and making it executable and this simple example:

cp /files/file.doc /media/flashdrive/

How can I automatically detect my current profile? (I have 3 profiles on my computer currently, one that I don't use, one for my wife which has no bookmarks, and mine).

  • what kind of data you will backup? – Book Of Zeus Dec 18 '11 at 19:25
  • i want to backup bookmark, some documents from my Documents folder (all of them), some system config (like hosts file) – fred Dec 18 '11 at 19:27

I would recommend to use rsync (In Ubuntu).

If you have hundreds of megs of data, you might only want to sync/backup the modified one. This will increase the backup speed.

As of other files like hosts you can simply cp

Now for the firefox, you need to find which profile you are using from the profiles.ini then you can copy the bookmarks.html

You can use grep to find out what's the folder the profiles.ini use:

grep Path ~/.mozilla/firefox/profiles.ini

that will output:


Then remove the Path=

sed "s/Path=//g"

Here's what the backup.sh will look like:

rsync -rltDqv ~/Documents/ /media/flashdrive/Documents/
cp ~/.mozilla/firefox/`grep Path ~/.mozilla/firefox/profiles.ini | sed "s/Path=//g"`/bookmarks.html /media/flashdrive/bookmarks.html
cp /etc/hosts /media/flashdrive/hosts

Now, chmod +x your backup.sh and then run it ./backup

  • quick question: where should i put the backup.sh? can i run it from anywhere? – fred Dec 18 '11 at 19:38
  • you can copy the script in the /usr/sbin or create a folder in your home folder and modify the .profile to look for executable files in this folder like then add this code to the .profile if [ -d "$HOME/bin" ] ; then PATH="$HOME/bin:$PATH" fi – Book Of Zeus Dec 18 '11 at 19:45

For Firefox, I think you can use Firefox's "Sync" feature to sync your profiles.

For backup documents, you can also try some software like unison or FreeFileSync.

  • 6
    sorry i want to backup my bookmark on my flashdrive, i didn't like the sync feature so i dont use it, ill check these software thanks – fred Dec 18 '11 at 19:24

Manually back up the profile

If you are comfortable with copying files and folders you can manually back up your profile. This process can be as simple as copying a single directory to a backup location. Most of the work is in finding where the profile folder is stored.

It's a good idea to first get rid of any unnecessary files to reduce the size of your backup.
    Firefox: " Tools -> Options-> Advanced -> Network -> (under Offline Storage or Cached Web Content) -> Clear Now"
    Mozilla Suite/SeaMonkey: Edit -> Preferences -> Advanced -> Cache -> Clear Cache, as well as compact your mail.
    Thunderbird: Compact your mail. 
Completely exit or quit the application. Mozilla Suite and SeaMonkey 1.x users on Windows should also exit Mozilla Quick Launch if its enabled.
Find the "Mozilla" (for Mozilla Suite/SeaMonkey 1.x), "SeaMonkey" (for SeaMonkey 2), "Firefox", or "Thunderbird" folder in the profile folder path that contains the registry.dat file or profiles.ini file and the "Profiles" folder (Windows and Mac) or <profile name> folder (Linux). See Profile folder - Firefox , Profile folder - Thunderbird and Profile folder - SeaMonkey for the location.
Copy the "Mozilla" "SeaMonkey" "Firefox" or "Thunderbird" folder to the backup location. This will back up all profiles in the default location and the "registry.dat" or "profiles.ini" file that keeps track profiles.
If you have created any profiles in a custom location, copy them to the backup location and make a note of the original location. 

Mail is stored by default within the profile. If you re-configured Thunderbird, Mozilla Suite or SeaMonkey to store an accounts messages outside of the profile, you need to also copy the "local directory" for that account. Look in Account settings to find the location of each account's local directory. [edit] Manually restore the profile

To restore a profile backup:

Close the application whose profile you're going to restore. If you're using Mozilla Suite or SeaMonkey 1.x you should also exit Mozilla Quick Launch if its enabled.
Copy each folder you backed up to the exact same location that it was in when you made the backup

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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