Overview
rsync is a popular fast, versatile, remote (and local) file-copying tool for Linux and Windows.
1. Download latest version, e.g.:
Linux: apt update ; apt install rsync
Windows: Rsync for Windows
To view package contents: e.g.:
Ubuntu/debian: dpkg -L rsync
You can change default values either via: ssh_config or:
~/.bashrc
RSYNC_RSH="ssh -p 4 -o VisualHostKey=yes" ; export RSYNC_RSH
If 2FA is enabled, install Duo Mobile app & then use enrollment link, register Duo Push for convenience.
- Android
- iPhone
2. Examples:
From Linux Command Prompt (bash):
For help, use man (manual):
man rsync
Display remote directory:
rsync --list-only userid@hostname:/
Copy file to remote:
rsync localfile userid@hostname:/
Useful switches:
--list-only list the files instead of copying them -n, --dry-run perform a trial run with no changes made -v, --verbose increase verbosity --log-file=FILE log what we're doing to the specified FILE -S, --sparse handle sparse files efficiently -a, --archive archive mode; equals -rlptgoD (no -H,-A,-X) -r, --recursive* recurse into directories -l, --links copy symlinks as symlinks -p, --perms preserve permissions -t, --times* preserve modification times -g, --group preserve group -o, --owner preserve owner (super-user only) -D same as --devices --specials -H, --hard-links preserve hard links -A, --acls preserve ACLs (implies -p) -X, --xattrs preserve extended attributes -P combines --progress and --partial (useful on large files) --progress show progress during transfer --partial allows resumption of interrupted transfers. --stats give some file-transfer stats -z compress (useful for transfers with other datacentres) -c, --checksum skip based on checksum, not mod-time & size -W, --whole-file copy files whole (w/o delta-xfer algorithm) --no-whole-file use delta-transfer, e.g on same disk copies. -e, --rsh=COMMAND specify the remote shell to use --delete delete extraneous files from dest dirs (Caution!)
Links:
- rsync web pages
- Wikipedia: rsync
Related links:
SSH
Linux
Windows Subsystem for Linux
Cygwin
Firewall