After the rsync server configuration is complete, the next step is to issue the rsync command on the client to back up the files on the server to the client. Rsync is a very powerful tool, and its commands have many special options. The following describes the options one by one.
The Command Format of Rsync can be as follows:
Rsync [OPTION]... SRC DEST
Rsync [OPTION]... SRC [USER @] HOST: DEST
Rsync [OPTION]... [USER @] HOST: SRC DEST
Rsync [OPTION]... [USER @] HOST: SRC DEST
Rsync [OPTION]... SRC [USER @] HOST: DEST
Rsync [OPTION]... rsync: // [USER @] HOST [: PORT]/SRC [DEST]
For the preceding six command formats, rsync has six different working modes:
1) copy a local file. This mode is enabled when the SRC and DES paths do not contain a single colon ":" separator. For example, rsync-a/data/backup
2) use a remote shell program (such as rsh and ssh) to copy the content of the local machine to the remote machine. This mode is enabled when the DST path address contains a single colon ":" separator. For example, rsync-avz *. c foo: src
3) use a remote shell program (such as rsh and ssh) to copy the contents of the remote machine to the local machine. This mode is enabled when the SRC address path contains a single colon ":" separator. For example, rsync-avz foo: src/bar/data
4) copy files from the remote rsync server to the local machine. This mode is enabled when the SRC path information contains the ":" separator. Such as: rsync-av root@172.16.78.192: www/databack
5) copy files from the local machine to the remote rsync server. This mode is enabled when the DST path information contains the ":" separator. Such as: rsync-av/databack root@172.16.78.192: www
6) List of remote machine files. This is similar to rsync transmission, but you only need to omit the local machine information in the command. For example, rsync-v rsync: // 172.16.78.192/www