Ubuntu file synchronization tool rsync

cp and scp are two commonly used commands for file copying in ubuntu. Generally, we use the cp command on the same server. We have used the scp command when crossing services. But if you do file synchronization, rsync is better than the above two commands. Use some, it's true across servers or not.
Because rsync can only synchronize the files that need to be updated, instead of copying all the files in the specified path, and then overwriting the source files in the target path, such as the local /mnt/tem folder and the remote xx.xx. To synchronize the /mnt/tem path of xx.123, you can use:

rsync -avu --progress /mnt/tem/ [email protected]:/mnt/tem

among them:

In addition, rsync copies soft links by default, which is different from scp, which copies soft links. If you want to synchronize soft connections with rsync, you need to specify the -l parameter.

- v,--verbose Verbose mode output.
- q,--quiet Reduced output mode.
- c,--checksum Turn on the check switch to force the file transfer to be checked.
- a,--archive Archive mode, which means to transfer files recursively, and keep all file attributes, equal to-rlptgoD。
- r,--Recursive processes subdirectories in recursive mode.
- R,--relative uses relative path information.
- b,--backup creates a backup, that is, when the same file name already exists for the purpose, rename the old file to~filename. can use--suffix option to specify a different backup file prefix.
- - backup-dir will backup files(Such as~filename)Stored in the directory.
- suffix=SUFFIX defines the backup file prefix.
- u,--update only updates, that is, skips all files that already exist in DST and the file time is later than the file to be backed up, and does not overwrite the updated files.
- l,--links retain soft links.
- L,--copy-links want to treat soft links like regular files.
- - copy-unsafe-links only copy links that point to outside the SRC path directory tree.
- - safe-links Ignore links that point to outside the SRC path directory tree.
- H,--hard-links retain hard links.
- p,--perms keep file permissions.
- o,--owner keeps the file owner information.
- g,--group keeps file group information.
- D,--devices Keep device file information.
- t,--times keep file time information.
- S,--sparse performs special processing on sparse files to save DST space.
- n,--dry-run shows which files will be transferred.
- w,--whole-file Copy files without incremental detection.
- x,--one-file-system Do not cross file system boundaries.
- B,--block-size=SIZE The block size used by the inspection algorithm. The default is 700 bytes.
- e,--rsh=command specifies the use of rsh and ssh for data synchronization.
- - rsync-path=PATH specifies the path information of the rsync command on the remote server.
- C,--cvs-exclude Use the same method as CVS to automatically ignore files to exclude files that you do not want to transfer.
- - existing only updates those files that already exist in DST, but does not back up those newly created files.
- - delete Delete files that are not in SRC in DST.
- - delete-Excluded also deletes the files on the receiving end that are excluded by this option.
- - delete-After the transmission is over, delete it again.
- - ignore-Errors will be deleted when IO errors occur in time.
- - max-delete=NUM can delete up to NUM files.
- - partial keeps those files that have not been completely transferred for some reason, so as to speed up the subsequent transfer again.
- - force Force delete the directory, even if it is not empty.
- - numeric-ids does not match numeric user and group ids to user and group names.
- - timeout=time ip timeout time, in seconds.
- I,--ignore-times does not skip files that have the same time and length.
- - size-only When deciding whether to back up files, only check the file size without considering the file time.
- - modify-window=NUM determines the time stamp window used when the files are the same time. The default is 0.
- T --temp-dir=DIR creates temporary files in DIR.
- - compare-dest=DIR also compares the files in DIR to determine whether it needs to be backed up.
- P is equivalent to--partial。
- - progress Shows the backup process.
- z,--compress compresses the backed up files during transmission.
- - exclude=PATTERN specifies a pattern to exclude files that do not need to be transferred.
- - include=PATTERN specifies the file pattern to be transferred without being excluded.
- - exclude-from=FILE Exclude files in the specified pattern in FILE.
- - include-from=FILE does not exclude files matching the FILE specified pattern.
- - version Print version information.
- - address is bound to a specific address.
- - config=FILE specifies other configuration files, do not use the default rsyncd.conf file.
- - port=PORT specifies another rsync service port.
- - blocking-io uses blocking IO for remote shells.
- stats gives the transfer status of certain files.
- - progress Realize the transfer process during transfer.
- - log-format=formAT specifies the log file format.
- - password-file=FILE gets the password from FILE.
- - bwlimit=KBPS limit I/O bandwidth, KBytes per second.
- h,--help Display help information.

Recommended Posts

Ubuntu file synchronization tool rsync
ubuntu unzip the rar file
rsync + sersync data synchronization - CentOS 8
Ubuntu: Install OMNeT++ simulation tool
Overview of the Ubuntu file system
Small tool: install screenshot tool under ubuntu
ubuntu fixed ip&FDFS upload file error
Ubuntu 20.04 use must install tool software
Build a file server on ubuntu