<\/span><\/h2>\n\n\n\nThe following syntax is most likely the most common form of rsync command that you will see.<\/p>\n\n\n\n
# rsync [options] \/source \/destination<\/pre>\n\n\n\nThese are the commonly used options<\/p>\n\n\n\n
-v, --verbose increase verbosity, provide more information about what the command is doing
-q, --quiet suppress non-error messages
-c, --checksum skip based on checksum, not mod-time and size
-a, --archive archive mode; equals -rlptgoD (no -H,-A,-X)
-r, --recursive recurse into directories
-u, --update skip files that are newer on the receiver
-d, --dirs transfer directories without recursing
-p, --perms preserve permissions
-E, --executability preserve executability
-A, --acls preserve ACLs (implies -p)
-X, --xattrs preserve extended attributes
-o, --owner preserve owner (super-user only)
-g, --group preserve group
-D same as --devices --specials
-t, --times preserve modification times
-S, --sparse handle sparse files efficiently
-n, --dry-run perform a trial run with no changes made
-W, --whole-file copy files whole (w\/o delta-xfer algorithm)
-x, --one-file-system don't cross filesystem boundaries
-B, --block-size=SIZE force a fixed checksum block-size
-e, --rsh=COMMAND specify the remote shell to use
-P same as --partial --progress<\/pre>\n\n\n\nFor example, we are going to sync files from \/var\/www\/html\/<\/code> to \/opt\/backup\/<\/code>. To complete this, we can run this command:<\/p>\n\n\n\n# rsync -Wav \/var\/www\/html\/ \/opt\/backup\/<\/pre>\n\n\n\nLet\u2019s break the command above down. The options are archive (-a)<\/code>, which tells rsync to copy files recursively and to preserve group and user ownership when it copies files. This option is actually a combination of option (-rlptgoD)<\/code> that includes recursive transfer, the transfer of file modification times, file permissions, symbolic links, etc.<\/p>\n\n\n\nWith this (-W)<\/code> option, the delta-transfer algorithm is not used and the whole file is sent as-is instead. 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.<\/p>\n\n\n\nThe verbose option (-v)<\/code> tells rsync to print more information about what it is doing to the terminal.<\/p>\n\n\n\n