Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

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 have been using to sync my local website directory to /home/public at my remote webhost.

However I am fed up doing this graphically, clicking 10-15 times, everytime I make a small change to my website.

How can I do this from the command line? I have ssh access to my remote webhost. I have never used rsync some pointers might be helpful.

share|improve this question
rsync -avhe ssh --delete /home/user/dir/

Quite simple and straightforward.

Hopefully you use git in your development process, then you can just use it instead.

More info on rsync here:

To deploy with git:

share|improve this answer

Something like this:

rsync -avh --delete /local/directory username@remotehost:/home/public

This will create directory within /home/public. If you however want to have the contents of directory directly in /home/public use something like (note that trailing slash):

rsync -avh --delete /local/directory/ username@remotehost:/home/public

Check out man rsync for more options. The ones used above:

  • --delete will remove nonexisting files on the remote host, so be careful about what you transfer.
  • a is for "archiving" and should be useful in most cases
  • h will enable human readable file sizes

Some additional options you may want to use:

  • --progress to see the current progress as well
  • --dry-run to see what would theoretically be transmitted (but don't actually transmit anything)
share|improve this answer

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.