- The rsync Tool
The rsync
tool copies files and directories between two computers. It uses a sophisticated algorithm that scans directory trees to find files on the source computer that don’t exist on the destination computer. These files are transmitted to the destination computer. What makes rync
so clever is it can figure out which pieces of existing files have been modified, and it only sends the changed portions.
You can use rsync
to copy files to a different location on your hard drive, to a different hard drive in the same computer, to an externally connected USB drive, or any other network-accessible location.
On top of that, rsync
can optionally preserve symbolic links, hard links, and file metadata such as file ownership, permissions, and access times. To support all this functionality, rsync
has many options and figuring them all out takes time. We’ve collected these 10 examples to help you get started. We’ve already written about doing backups with rsync
, so we’re concentrating on other uses here.
For all of its many options, the structure of an rsync
command is simple. We need to provide the source, the destination, and the options we want to use. You’ll probably find that rsync
is already installed on your Linux computer—it was, on all of our test machines—but if it isn’t it’ll definitely be in your distribution’s repositories.