LinuxCommandLibrary

zpaq

Compress and archive files

TLDR

Add a file or directory to a new or existing archive

$ zpaq [[a|add]] [path/to/archive.zpaq] [path/to/file_or_directory]
copy

Create or add to an encrypted archive
$ zpaq [[a|add]] -k[password] [path/to/archive.zpaq] [path/to/file_or_directory]
copy

Extract the most recent versions of files
$ zpaq [[x|extract]] [path/to/archive.zpaq]
copy

List the archive contents
$ zpaq [[l|list]] [path/to/archive.zpaq]
copy

Set the level of compression (higher means more compression but slower)
$ zpaq [[a|add]] [path/to/archive.zpaq] -m[1|2|3|4|5] [path/to/file_or_directory]
copy

Extract the specified files from the archive that are not newer than the specified date
$ zpaq [[x|extract]] [path/to/archive.zpaq] [path/in/archive/to/extract] -to [path/to/output] -until [YYYY-MM-DD]
copy

SYNOPSIS

zpaq command archive_file [files...] [options]

Common Commands:
  a: Add files to a new or existing archive.
  x: Extract files from an archive.
  l: List the contents of an archive.
  u: Update or append files to an archive (for incremental backups).
  t: Test the integrity of an archive.
  r: Repair a corrupted archive.

Examples:
  zpaq a backup.zpaq my_docs/ photos/
  zpaq x backup.zpaq
  zpaq l backup.zpaq

PARAMETERS

-mlevel
    Sets the compression level, where level is 0 (no compression) to 5 (maximum compression). Defaults to 3.

-method NAME
    Specifies the compression algorithm to use (e.g., 'zpaq' for context mixing, 'lzma', 'bzip2', 'store').

-id
    Enables incremental archiving. Only adds new or changed files based on their content ID (hash).

-force
    Forces overwrite of existing files during extraction without prompting.

-v
    Enables verbose output, displaying more details about the operation.

-s
    Creates a self-extracting archive (executable on systems that support it).

-pPASSWORD
    Encrypts the archive with the specified PASSWORD.

-exclude PATTERN
    Excludes files or directories matching the specified PATTERN from the archive.

-include PATTERN
    Includes only files or directories matching the specified PATTERN in the archive.

-temp DIR
    Specifies a temporary directory DIR to use during archiving or extraction.

DESCRIPTION

zpaq is a powerful command-line archiver known for its high compression ratios and advanced features, making it suitable for both general archiving and robust long-term data storage. It employs a sophisticated context-mixing algorithm (PPMD) for excellent compression and supports efficient incremental backups through block-level deduplication based on a rolling checksum. Key capabilities include the ability to store multiple versions of files, create self-extracting archives, and provide robust error correction for enhanced data integrity. zpaq is designed to be versatile, supporting various compression levels and the creation of solid archives. Its design prioritizes both compression efficiency and data reliability, making it a strong choice for demanding archival tasks.

CAVEATS

While highly efficient, zpaq is not as widely adopted as more conventional archiving tools like tar combined with gzip or xz. Its unique command syntax and focus on advanced features might present a steeper learning curve for new users. Performance can vary significantly depending on the chosen compression level, data type, and available system memory.

DEDUPLICATION

zpaq employs a sophisticated block-level deduplication mechanism. It uses a rolling checksum to identify identical blocks of data within files or across multiple archive versions, storing only unique blocks. This makes it exceptionally efficient for incremental backups, archiving multiple versions of similar files, or storing large datasets with redundant content.

ERROR CORRECTION

A significant feature of zpaq is its built-in error correction capabilities. Archives can be designed to include redundant information that allows for the detection and, in many cases, correction of data corruption. This greatly enhances the reliability and longevity of archived data, making it suitable for long-term storage where data integrity is critical.

SELF-EXTRACTING ARCHIVES

With the -s option, zpaq can create self-extracting archives. On compatible systems (like Windows with a bundled executable, or Linux with a shell script wrapper), these archives can unpack themselves without requiring zpaq to be separately installed, simplifying distribution and extraction for end-users.

HISTORY

zpaq was developed by Matt Mahoney, a prominent figure in the field of data compression research, known for his work on PPM (Prediction by Partial Matching) algorithms and the Hutter Prize. It emerged from his ongoing experiments in achieving maximum compression ratios using advanced context-mixing techniques. The project emphasizes robust error correction and efficient incremental archiving, reflecting a focus on both data density and long-term data integrity.

SEE ALSO

tar(1), gzip(1), bzip2(1), xz(1), 7z(1)

Copied to clipboard