LinuxCommandLibrary
GitHubF-DroidGoogle Play Store

rdiff

Compute and apply rsync-style file deltas

TLDR

Create signature file
$ rdiff signature [original] [signature.sig]
copy
Create delta from signature
$ rdiff delta [signature.sig] [new_file] [delta.delta]
copy
Apply delta to recreate
$ rdiff patch [original] [delta.delta] [output]
copy

SYNOPSIS

rdiff command [options] files

DESCRIPTION

rdiff computes and applies binary deltas using the rsync algorithm. It enables efficient file synchronization by transferring only the differences between files.

PARAMETERS

-b blocksize

Block size (bytes) for the signature. Smaller = more accurate delta but larger signature.
-s, --statistics
Print signature / delta timing and size statistics.
-S sum
Length (bytes) of the strong checksum in the signature (default 8).
-H hash
Hash algorithm: `md4` (legacy) or `blake2` (default for librsync ≥ 2).
-R, --rollsum, -I, --rabinkarp
Select the rolling checksum variant (rabinkarp is the default).
-f, --force
Overwrite the output file if it already exists.
-z, --compress FORMAT
Compress deltas with `gzip` or `bzip2` when writing.
-v, --verbose
Increase verbosity. Repeat for more detail.
-V, --version
Print librsync version and exit.

EXAMPLES

$ # Create signature
rdiff signature original.tar sig.sig

# Create delta (only differences)
rdiff delta sig.sig modified.tar changes.delta

# Apply delta to recreate file
rdiff patch original.tar changes.delta reconstructed.tar

# With statistics
rdiff -s signature largefile sig
copy

COMMANDS

signature basis [sig]

Create signature of basis file.
delta sig new [delta]
Create delta from signature and new file.
patch basis delta [output]
Apply delta to basis file.

WORKFLOW

$ 1. Create signature of original (small)
2. Send signature to remote
3. Remote creates delta against new file
4. Send delta back (efficient)
5. Apply delta to reconstruct
copy

CAVEATS

Part of librsync. Basis file needed for patch. Signature must match original file version.

HISTORY

rdiff uses the rsync algorithm by Andrew Tridgell, implemented in librsync by Martin Pool.

SEE ALSO

rsync(1), diff(1), patch(1), xdelta(1)

Copied to clipboard
Kai