↑ ↓ select, Enter open, Esc close

Transfer files to another server with rsync over SSH

Caution: This command changes the system. Understand what it does before you run it.

Adjust the values, the command updates live
user@server
rsync -avz -e 'ssh -p 22' /var/www/vhosts/example.com/httpdocs/ webuser@backup.example.com:/home/webuser/backup/httpdocs/

Copies the contents of the source to the target server over SSH, and -z compresses the data in transit. Later runs only transfer changed files. To reverse the direction, use BENUTZER@HOST:PFAD/ as the source and a local path as the destination.

Note: rsync must be installed on both servers. For automated runs, set up an SSH key without a passphrase prompt.

Also searched as

  • rsync to remote server
  • rsync with different ssh port
  • migrate website to new server
  • backup over ssh

Related one-liners

All in rsync and backup

Read first, then run.

The commands on myline.de act directly on servers, files and databases. A wrong path or placeholder can delete data irreversibly or make a server unreachable.

  • All commands are provided without warranty and are not tested on every system.
  • Understand what a command does before running it, and check every placeholder.
  • Make a backup first and, if possible, try it on a test system.
  • You run commands at your own risk. Liability for damages is excluded to the extent permitted by law.