Data Centers

How to become an rsync power user with Grsync

Marco Fioretti shows how to use a graphical front-end to the rsync backup tool called Grsync, which can help beginners learn the command line.

Grsync is a nice, little graphical tool that has several advantages. The first one is very practical: Grsync facilitates the usage of the command line program rsync, which performs a critical task such as backing up local or remote directory trees in a very efficient way. The other advantage is educational: Grsync makes it easier to learn how to write certain kinds of scripts. Finally, this utility is a good example of how "learning the command line" may be made much easier for beginners.

Installation and user interface

Grsync is available as a binary package in several Gnu/Linux distributions. The screenshots in this post come from Grsync 1.2.0, which is the version available in Fedora 16. According to its change log, the current stable version, that is 1.2.2, only has minor modifications.

The graphical interface provides, as you can see in the screenshots, three separate panels for basic, advanced, and extra options.

Figure A

Figure B

Every radio button you click adds the corresponding text to an rsync command line. Once you are done, you can click on the missile icon to actually execute it, or simply get information about what would happen if you launched the backup: the button to click for this purpose is the one with the "i" label.

Local usage is a snap

The opening paragraph of the grsync man page says that Grsync ... can be used effectively for local directory synchronization. Indeed, using Grsync to make local backups, for example, on external USB drives, is really simple. You must only remember how picky rsync is when it comes to trailing slashes in path names.

If, for example, you wanted to make a perfect duplicate of a certain directory, say /home/marco/Documents, to another directory with the same name on /media/my_USB_drive, you should specify the source and destination paths in this way:

  source:      /home/marco/Documents/
  destination: /media/my_USB_drive/Documents

See what I meant? You must put a slash at the end of the source path, and omit it at the end of the destination path. Otherwise, rsync (remember, Grsync only is a front-end!) will put everything in /media/mydrive/Documents/Documents. Apart from this, Grsync will work fine for most users with the default options, but trying them one by one is easy. Of course, to restore from backups, you would just switch source and destination in the Grsync File menu.

Remote usage... is just a bit trickier

Backups of critical data only make sense if you (also) make remote ones, far away from your home or office. That's the only way to protect your data from fire, burglary or other catastrophes. Rsync can perform remote backups through secure SSH connections without problems. To tell it to do it through Grsync, however, you must know the right way to pass certain parameters.

Let's assume you have an account on a remote Unix or Linux server, which is only accessible via ssh, and you want to make a complete copy of your /home/username/Documents directory there.

The default TCP port number for ssh connections is 22. Many servers, however, listen on other ports for security reasons that we won't discuss here. In order to use Grsync for remote backups on such a server, you must pass to the program:

  • the server name
  • your account name
  • the protocol to use (that is, ssh)
  • the corresponding port number

The right way to do this is very simple, once you know it, but may be explained a bit better in the documentation. First, you need to put your account and server name before the destination path:


Protocol and port number, instead, must be written in the "Additional options" text box of the Advanced options panel, exactly in this way:

-e \"ssh -p PORTNUMBER\"

If you forget to escape the double quotes, Grsync won't pass them correctly to rsync, and that program will fail. With respect to authentication, if you have already configured your computer to use password-less connections with the SSH server, there is nothing else to worry about. Otherwise, you will have to install one of the graphical front-ends to ssh-askpass, because Grsync will need it to ask you the password and pass it to rsync.

The power of "before" and "after" commands

Please now have a look at Figure C, which shows one of the best features of Grsync: the ability to set other commands to run right before or after the rsync backup. For example you may, as I hinted in the figure, mirror your remote mailboxes with offlineIMAP right before making an extra remote copy with rsync.

Figure C

Sessions and scripting

Grsync is useful, but if it could only do what I've mentioned so far it wouldn't be much of a helper. What makes it really interesting, in my opinion, are session support and scripting assistance. The first feature lets you save in external, plain text files, all the parameters for a certain rsync procedure, and load them automatically later on (grsync also comes with a companion program that runs unattended, grsync-batch).

"Scripting assistance" means that you can use Grsync to quickly create the rsync command that is best for you, and then reuse it elsewhere! To do this, press Alt+R or select "Rsync command line" from the file menu, then copy and paste in a file the text that will appear in a pop-up window. That is a working rsync command that you can study or insert in scripts, to automatize as many operations as possible, even on computers where Grsync is not installed!. Isn't that cool? And how easier would it be to learn the secrets of command line programs, if they all had a graphical "teacher" as Grsync?


Marco Fioretti is a freelance writer and teacher whose work focuses on the impact of open digital technologies on education, ethics, civil rights, and environmental issues.

Editor's Picks