Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I have been using Transmit.app 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
add comment

2 Answers

rsync -avhe ssh --delete /home/user/dir/ [email protected]: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:

http://www.linux.com/news/enterprise/storage/8200-back-up-like-an-expert-with-rsync

To deploy with git:

http://philsturgeon.co.uk/news/2010/02/Deploying-websites-with-Git

share|improve this answer
add comment

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
add comment

Your Answer

 
discard

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.