If you liked this post on how to send and download files using rsync, please share it with your friends on the social networks using the buttons below or simply leave a reply in the comments sections. They are available 24×7 and will take care of your request immediately. Of course, you don’t have to send and download files using rsync if you use one of our Linux VPS Hosting services, in which case you can simply ask our expert Linux admins to send and download files using rsync for you. To learn more about the available options, you can run man rsync while in your terminal. You have learned how to send and download files using rsync. The command will look like this # rsync /SOURCE # rsync -Wav -e 'ssh -p 7022' /home/master/ course, the user account you are referencing on the remote server will need to have the correct permissions to write to the destination directory. Then the said user account should have written permission in the remote server. You can specify a remote user account if it’s different than the one you use to send the files using rsync. This time, the destination will be a remote system while the source is local, so it is considered as sending files. The last one, pay attention to the trailing slash in the source ( /var/If you do not add a trailing slash, then the command will copy the html directory and its contents. If the remote server’s SSH port is the default port 22, you can simply use ‘-e ssh’ as the option in the rsync command syntax. Since the SSH on the remote server is listening on port 7022, we can add it as ‘ssh -p 7022’. This option is used to specify the remote shell to use and what port we are going to connect to.
# rsync -Wav -e 'ssh -p 7022' /home/master/Īs you can see, we added an option (-e). We need to log in to our server at 5.6.7.8 and run this command. Let’s say we are going to download or copy /var/www/html/ to /home/master/ # rsync /DESTINATIONįor example, we want to download or copy a directory from our server at IP address 1.2.3.4 to another server at 5.6.7.8. Basically, the command is the same, we only need to replace the source with an SSH username of the remote server because the transfer will use an SSH connection.
Now, we are going to download files from a remote server using rsync. In the previous step, we learned how to copy files from one location to another using rsync. The verbose option (-v) tells rsync to print more information about what it is doing to the terminal. This is the default when both the source and destination are specified as local paths, but only if no batch-writing option is in effect. With this (-W) option, the delta-transfer algorithm is not used and the whole file is sent as-is instead. This option is actually a combination of option (-rlptgoD) that includes recursive transfer, the transfer of file modification times, file permissions, symbolic links, etc.
The options are archive (-a), which tells rsync to copy files recursively and to preserve group and user ownership when it copies files. To complete this, we can run this command: # rsync -Wav /var/www/html/ /opt/backup/ e, -rsh=COMMAND specify the remote shell to useįor example, we are going to sync files from /var/www/html/ to /opt/backup/.
B, -block-size=SIZE force a fixed checksum block-size x, -one-file-system don't cross filesystem boundaries
W, -whole-file copy files whole (w/o delta-xfer algorithm)
n, -dry-run perform a trial run with no changes made S, -sparse handle sparse files efficiently o, -owner preserve owner (super-user only) E, -executability preserve executability d, -dirs transfer directories without recursing u, -update skip files that are newer on the receiver a, -archive archive mode equals -rlptgoD (no -H,-A,-X) c, -checksum skip based on checksum, not mod-time and size These are the commonly used options -v, -verbose increase verbosity, provide more information about what the command is doing The following syntax is most likely the most common form of rsync command that you will see.