Ask Ubuntu is a question and answer site for Ubuntu users and developers. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I need to take incremental backup of users files which is located in the following location automatically using a cron job. Could anyone explain the procedure to take backup using rsync in detail pls?

Location: /home/user1/Desktop/

Note: The backup should be saved as follows, if the system IP is the backupfile should be named as user10 and so on. How to acheive this ?

share|improve this question
up vote 2 down vote accepted

Open a terminal and type: man rsync

But seriously, if you're just wanting to do a backup that copies what you currently have in ~/Desktop to that location and not store any backlog or anything like that you could use:

rsync -azve ssh --delete /home/user1/Desktop

You'll have to install openssh-server on the receiving side though. Or you could create a script in /etc/init.d to start rsync --deamon on the remote machine at boot and remove the e ssh part

Here's a breakdown of the options: -a archive mode (recurse directories and keep permissions, etc), -v verbose mode, -e ssh use the SSH protocol for the transfer, --delete delete extraneous files on the receiving side.

share|improve this answer
That's assuming he has an rsync daemon running on the other machine. (-a is the same as -rt [more specifically -rlptgoD]). He could use -u, but I think it's unnecessary unless it's a folder used by somebody else as well. – Chuck R Feb 18 '12 at 14:17
Greetings: rsync --progress --hurtz /directory/to/backup validUser@ Keep in mind that you wont be able to rsync without being prompted for a password, so to rsync without having to type a password you can read this tut: – kingmilo Feb 18 '12 at 14:24
the rsync utility is installed in Ubuntu by default. – kingmilo Feb 18 '12 at 14:30
I completely forgot about the fact that he's doing it through a cron job... that might be an issue. Good link. That's how I reach my machine for cron jobs as well. – Chuck R Feb 18 '12 at 14:31
But it's not enabled as a daemon. It needs an /etc/rsyncd.conf which isn't provided. And rsync's a picky beast that I only use when absolutely necessary, so I avoid dealing with it at all costs HAHA – Chuck R Feb 18 '12 at 14:32

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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