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 bookmark, personal documents, etc....

in windows i copy everything manually and in my ubuntu i want to create a bash script to automatically.

i have no knowledge of bash script experience other than create a file and make it executable and this:

#!/bin/bash
cp /files/file.doc /media/flashdrive/

now, my problem is the firefox bookmark, how can i automatically detect my current profile? (i have 3 profile in my computer currently, 1 old i dont use, 1 for my wife which has no bookmark and mine)

link|improve this question
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
+1 for migrating to Ubuntu – Book Of Zeus Dec 18 '11 at 19:35
feedback

migrated from stackoverflow.com Dec 19 '11 at 17:42

This question came from our site for professional and enthusiast programmers.

2 Answers

up vote 17 down vote accepted

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:

Path=e8tog617.default

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

link|improve this answer
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
thanks again for this tip – fred Dec 18 '11 at 19:47
feedback

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.

link|improve this answer
4  
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
feedback

Your Answer

 
or
required, but never shown

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