rsync - Easily Transfer and Synchronize Files Between Computers
rsync is a great utility that can be use for transferring files to and from a remote computer. It can be use to sync files between the computers as well.
rsync can be installed from the package manager on a Debian system:
sudo apt install rsync -y
The basic syntax for rsync is as follows:
rysnc -optional-flags soruce-file-location destination-file-location
One of the rsync command I prefer to use is the following:
#Sync file from source to destination, keeping source file attributes, show human readable progress,
#and delete files afterwards from destination if file exisits in destination but not in source
rsync -ah -r --progress source-file destination-file --delete-after
rsync Flags Reference
rsync have many possible flags to use. Below are a list of the flags according to the official manual:
Flags | Shorthand |
Description |
--verbose |
-v |
increase verbosity |
--quiet | -q | |
--no-motd | ||
--checksum | -c | |
--archive | -a | |
--no-OPTION | ||
--recursive | -r | |
--relative | -R | |
--no-implied-dirs | ||
--backup | -b | |
--backup-dir=DIR | ||
--suffix=SUFFIX | ||
--update | -u | |
--inplace | ||
--append | ||
--append-verify | ||
--dirs | -d | |
--links | -l | |
--copy-links | -L | |
--copy-unsafe-links | ||
--safe-links | ||
--copy-dirlinks | -k | |
--keep-dirlinks | -K | |
--hard-links | -H | |
--perms | -p | |
--executability | -E | |
--chmod=CHMOD | ||
--acls | -A | |
--xattrs | -X | |
--owner | -o | |
--group | -g | |
--devices | ||
--specials | ||
-D | ||
--times | -t | |
--omit-dir-times | -O | |
--super | ||
--fake-super | ||
--sparse | -S | |
--dry-run | -n | |
--whole-file | -W | |
--one-file-system | -x | |
--block-size=SIZE | -B | |
--rsh=COMMAND | -e | |
--rsync-path=PROGRAM | ||
--existing | ||
--ignore-existing | ||
--remove-source-files | ||
--del | ||
--delete | ||
--delete-before | ||
--delete-during | ||
--delete-delay | ||
--delete-after | ||
--delete-excluded | ||
--ignore-errors | ||
--force | ||
--max-delete=NUM | ||
--max-size=SIZE | ||
--min-size=SIZE | ||
--partial | ||
--partial-dir=DIR | ||
--delay-updates | ||
--prune-empty-dirs | -m | |
--numeric-ids | ||
--timeout=SECONDS | ||
--contimeout=SECONDS | ||
--ignore-times | -I | |
--size-only | ||
--modify-window=NUM | ||
--temp-dir=DIR | -T | |
--fuzzy | -y | |
--compare-dest=DIR | ||
--copy-dest=DIR | ||
--link-dest=DIR | ||
--compress | -z | |
--compress-level=NUM | ||
--skip-compress=LIST | ||
--cvs-exclude | -C | |
--filter=RULE | -f | |
-F | ||
--exclude=PATTERN | ||
--exclude-from=FILE | ||
--include=PATTERN | ||
--include-from=FILE | ||
--files-from=FILE | ||
--from0 | -0 | |
--protect-args | -s | |
--address=ADDRESS | ||
--port=PORT | ||
--sockopts=OPTIONS | ||
--blocking-io | ||
--stats | ||
--8-bit-output | -8 | |
--human-readable | -h | |
--progress | ||
-P | ||
--itemize-changes | -i | |
--out-format=FORMAT | ||
--log-file=FILE | ||
--log-file-format=FMT | ||
--password-file=FILE | ||
--list-only | ||
--bwlimit=KBPS | ||
--write-batch=FILE | ||
--only-write-batch=FILE | ||
--read-batch=FILE | ||
--protocol=NUM | ||
--iconv=CONVERT_SPEC | ||
--checksum-seed=NUM | ||
--ipv4 | -4 | |
--ipv6 | -6 |
|
--version | ||
--help | (-h) |