Sync Firefox from the Command Line
There are lots of solutions for syncing Firefox, and I must confess I haven't used any of them. As I've read the descriptions, I've always gotten the sense that they wouldn't do what I wanted, the way I wanted it, when I wanted it. Necessity being the mother of invention, I wrote my own shell script to do what I needed.
I have Firefox running on four Linux systems and one Windows system, and all of them have the same extensions installed. My sync is a simple rsync of the Firefox settings directory from another system. This copies bookmarks and passwords, and I have used it for quite some time without any ill effects:
#!/bin/bash
user_name=mitch
if [[ ! "$1" ]]; then
echo "Usage: $0 FROM-HOST"
exit 1
fi
# Check for cygwin.
if [[ -d /cygdrive/c ]]; then
rpath=/home/$user_name/.mozilla/firefox/default.enr
lpath="$(find /cygdrive/c/Documents\ and\ Settings/$user_name/Application\ Data/Mozilla/Firefox/Profiles/ -iname '*.default')"
else
rpath=~/.mozilla
lpath=~/.mozilla
fi
rsync -av --delete --exclude=Cache --exclude=lock "$1":"$rpath/" "$lpath"
If you have Cygwin installed, the script will work from Windows systems also. Its usage is simple: first shut down Firefox, then invoke the script and give it a hostname or IP address to sync from:
$ syncff my-other-system
Obviously, you will need to modify the script to make sure that the paths it uses are valid for your installation.
One shortcoming is that this script will not work with a Cygwin system as the other system. That should be possible, but the script will need modifications and testing to accomplish it. When syncing Linux systems, I sync the entire .mozilla directory, which should probably work even if you use Seamonkey or have the Eclipse browser component installed, but test it to be sure, and shut them down before syncing also.
You may notice the rsync command excludes not only the Cache directory but a file named lock. If you don't exclude the lock file, Firefox will think that another instance is already running when it starts up.
Mitch Frazier is an Associate Editor for Linux Journal.
Realizing the promise of Apache® Hadoop® requires the effective deployment of compute, memory, storage and networking to achieve optimal results. With its flexibility and multitude of options, it is easy to over or under provision the server infrastructure, resulting in poor performance and high TCO. Join us for an in depth, technical discussion with industry experts from leading Hadoop and server companies who will provide insights into the key considerations for designing and deploying an optimal Hadoop cluster.
Sponsored by AMD
Built-in forensics, incident response, and security with Red Hat Enterprise Linux 6
Every security policy provides guidance and requirements for ensuring adequate protection of information and data, as well as high-level technical and administrative security requirements for a system in a given environment. Traditionally, providing security for a system focuses on the confidentiality of the information on it. However, protecting the data integrity and system and data availability is just as important. For example, when processing United States intelligence information, there are three attributes that require protection: confidentiality, integrity, and availability.
Learn more about catching the bad guy in this free white paper.
Sponsored by DLT Solutions
| Designing Electronics with Linux | May 22, 2013 |
| Dynamic DNS—an Object Lesson in Problem Solving | May 21, 2013 |
| Using Salt Stack and Vagrant for Drupal Development | May 20, 2013 |
| Making Linux and Android Get Along (It's Not as Hard as It Sounds) | May 16, 2013 |
| Drupal Is a Framework: Why Everyone Needs to Understand This | May 15, 2013 |
| Home, My Backup Data Center | May 13, 2013 |
- I once had a better way I
3 hours 17 min ago - Not only you I too assumed
3 hours 35 min ago - another very interesting
5 hours 28 min ago - Reply to comment | Linux Journal
7 hours 21 min ago - Reply to comment | Linux Journal
14 hours 15 min ago - Reply to comment | Linux Journal
14 hours 32 min ago - Favorite (and easily brute-forced) pw's
16 hours 23 min ago - Have you tried Boxen? It's a
22 hours 15 min ago - seo services in india
1 day 2 hours ago - For KDE install kio-mtp
1 day 2 hours ago
Enter to Win an Adafruit Pi Cobbler Breakout Kit for Raspberry Pi

It's Raspberry Pi month at Linux Journal. Each week in May, Adafruit will be giving away a Pi-related prize to a lucky, randomly drawn LJ reader. Winners will be announced weekly.
Fill out the fields below to enter to win this week's prize-- a Pi Cobbler Breakout Kit for Raspberry Pi.
Congratulations to our winners so far:
- 5-8-13, Pi Starter Pack: Jack Davis
- 5-15-13, Pi Model B 512MB RAM: Patrick Dunn
- 5-21-13, Prototyping Pi Plate Kit: Philip Kirby
- Next winner announced on 5-27-13!
Featured Jobs
| Linux Systems Administrator | Houston and Austin, Texas | Host Gator |
| Senior Perl Developer | Austin, Texas | Host Gator |
| Technical Support Rep | Houston and Austin, Texas | Host Gator |
| UX Designer | Austin, Texas | Host Gator |
| Web & UI Developer (JavaScript & j Query) | Austin, Texas | Host Gator |
Free Webinar: Hadoop
How to Build an Optimal Hadoop Cluster to Store and Maintain Unlimited Amounts of Data Using Microservers
Realizing the promise of Apache® Hadoop® requires the effective deployment of compute, memory, storage and networking to achieve optimal results. With its flexibility and multitude of options, it is easy to over or under provision the server infrastructure, resulting in poor performance and high TCO. Join us for an in depth, technical discussion with industry experts from leading Hadoop and server companies who will provide insights into the key considerations for designing and deploying an optimal Hadoop cluster.
Some of key questions to be discussed are:
- What is the “typical” Hadoop cluster and what should be installed on the different machine types?
- Why should you consider the typical workload patterns when making your hardware decisions?
- Are all microservers created equal for Hadoop deployments?
- How do I plan for expansion if I require more compute, memory, storage or networking?



Comments
Check out the plugin for
Check out the plugin for firefox called foxmark. It will sync your bookmarks and optionally your login/password info up into the cloud where all your firefoxes can then push/pull from. It's completely secure. Check it out here: http://www.foxmarks.com/
Firefox sync
Thanks for the confirmation Sam M.
See my 10 cents of the 8th and subsequent responses.
Excludes, rsync+Cygwin
You should also exclude ".parentlock".
To have the Cygwin system as the remote system, you need to have rsync running as a daemon -- read the man page, but it's basically "rsync --daemon". (Linux boxes have xinetd to fire up insecure daemons when they're needed.)
It would be trivial to add a backup to this, and that's where version control comes in. For automation, RCS is sufficient. Of course, you'd need a restore script too.
To whoever "desQEDo" thinks he is, this is significant, because it's straightforward and it's scriptable. You can't run a UI application from cron. However, you can add a UI to a script. Sheesh.
Firefox
OK, side-stepping the indignant response, and hoping it triggered more than that because I'm always very grateful for good and usable solutions. Just thinking a little further: if the scripts are so very trivial and significant, then could they not be developed the few steps further to create a solution, including UI, to help promote and further the usefulness of the operating system as a whole to a wider audience?
I don't pretend to be a command-line expert, my point was simply that there are so many good ideas out there, and here, in such tech fora that don't see the light of day although they may well be more useful than current solutions. Perhaps this one needs just a little more to become useful to more than the cron-ies who, although in the minority, are the only ones able to contribute useful code and in so doing support Linux advancement.
I love this OS, use it as far as possible, promote it whenever I can and point to the number and usefulness of the applications and also the generally helpful response of the community when looking for solutions. Sorry to spoil your fun. Sheesh indeed!
sync firefox
Come on Mitch/Linux Journal, what is the real how-to value here considering the caveats mentioned? Whereas the command line may be interesting the exercise seems a bit of a waste of time and space when cross-platform utilities like Foxmarks/Xmarks are available for exactly the purpose outlined here. I use it and it just works.
Let's stop jerking around about how good we are with terminal and use this expertise to make the Linux world more useful and productive for real work - but maybe I missed the point...
Disappointed, and a reason why I cancelled my subscription...
Firefox
That's worth trying. So simple why didn't I think of that? ...
:)
sync firefox
Hey Mitch,
Wonderful approach to it. I like the way you did it.
Thanks
Bhaskar
Version control
I've recently started thinking you could do something like this with a version control system, like bzr or git. That might help get around some of the problems when using rsync.