Quick Linux Tip #25:
Try: rsync -avz --checksum --delete /var/www/ linuxteck@backup:/var/www/
Info: --checksum compares file contents rather than timestamps to catch true changes. --delete removes destination files that no longer exist on the source.
Examples:
- $ rsync -avz --dry-run /src/ user@host:/dst/ # Dry-run preview
- $ rsync -avz --exclude='*.log' --exclude='cache/' /src/ /dst/
- $ rsync -avz --link-dest=/prev/backup /source/ /new/backup/ # Hardlink backups
Note: --checksum increases disk I/O as it reads both ends entirely. Always test destructive syncs with --dry-run first. Trailing slashes control whether contents or directories are copied.
Follow @LinuxTeck for more #LinuxTips
Leave a Reply