Backup Firefox bookmarks and other personal files bash script
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:
#!/bin/bash
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).
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
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.