Name
rsync [options] source destination — rsync
Synopsis
/usr/bin stdin stdout - file -- opt --help --versionThe rsync command copies a set of files. It can make an exact copy, including file permissions and other attributes (called mirroring), or it can just copy the data. It can run over a network or on a single machine. rsync has many uses and over 50 options; we’ll present just a few common cases relating to backups.
To mirror the directory D1 and its contents into another directory D2 on a single machine:
$ rsync -a D1 D2
In order to mirror directory D1 over the network to another host, server.example.com, where you have an account with username smith, securing the connection with SSH to prevent eavesdropping:
$ rsync -a -e ssh D1 smith@server.example.com:
Useful options | |
| Copy the ownership of the files. (You probably need superuser privileges on the remote host.) |
| Copy the group ownership of the files. (You might need superuser privileges on the remote host.) |
| Copy the file permissions. |
| Copy the file timestamps. |
| Copy directories recursively, i.e., including their contents. |
| Permit symbolic links to be copied (not the files they point to). |
| Permit devices to be copied. (Superuser only.) |
| Mirroring: copy all attributes of the original files. This implies all of the options, |
| Verbose mode: print information about what’s happening during the copy. Add |
| Specify a different remote shell program such ... |
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access