LinuxCommandLibrary

lrzip

Compress files for high ratio and speed

TLDR

Compress a file with LZMA - slow compression, fast decompression

$ lrzip [path/to/file]
copy

Compress a file with BZIP2 - good middle ground for compression/speed
$ lrzip -b [path/to/file]
copy

Compress with ZPAQ - extreme compression, but very slow
$ lrzip -z [path/to/file]
copy

Compress with LZO - light compression, extremely fast decompression
$ lrzip -l [path/to/file]
copy

Compress a file and password protect/encrypt it
$ lrzip -e [path/to/file]
copy

Override the number of processor threads to use
$ lrzip -p [8] [path/to/file]
copy

SYNOPSIS

lrzip [options] infile [ outfile ]

PARAMETERS

-q
    Quiet mode (suppress non-error messages).

-v
    Verbose mode (display more information).

-z
    Compress using the zstd compressor (default for compression levels > 7).

-l
    Compress using the lzo compressor.

-b
    Compress using the bzip2 compressor (default).

-g
    Compress using the gzip compressor.

-L
    Set compression level (0-9, higher is better but slower. Default is 7).

-k
    Keep (don't delete) the input file after compression/decompression.

-d
    Decompress.

-t
    Test compressed file integrity.

-o
    Specify output file name.

-p
    Number of parallel threads to use. Defaults to the number of cores.

-S
    Split output into chunks of this size after compression.
Uses suffixes .000 to .999, each the specified size, except the last

-n
    Do not use the LRZIP file signature, use a raw external compressor stream. (Advanced)

-U
    Force Unix attributes to be stored (default), for compatibility, even on windows. (Advanced)

-W
    Allow use of external compressors which may have security concerns. (Advanced)

--help
    Display help message.

--version
    Display version information.

DESCRIPTION

lrzip is a long range zip (LZ) compressor designed for achieving very high compression ratios on large files. It aims to exploit long distance redundancy by searching through larger data windows than traditional compressors, leading to better compression for many data types, especially those with repetitive patterns or similar sections across a large span.

lrzip can also use multiple external compressors (lzo, zstd, bzip2, gzip) to perform the last stage of compression, allowing you to tune the speed vs compression ratio. This also makes it more versatile, since the compression is tunable. Decompression is usually slower than compression, and lrzip may use multiple CPU cores to speed up both compression and decompression.

It is particularly effective on large source code archives, virtual machine images, or any large data set containing compressible patterns or repetition. Note that the increased compression comes at the expense of higher memory usage and processing time.

CAVEATS

Decompression is slower than compression. High compression levels require significant memory. The .lrz extension is automatically appended or removed during compression/decompression unless the -o option is used.

FILE SPLITTING

The -S option allows you to split the compressed output into multiple files of a specified size. This is useful for transferring large files over media with size limitations, or when distributing data across multiple storage devices.

COMPRESSION LEVEL

The -L option controls the compression level. Higher levels generally result in smaller file sizes, but require more processing time and memory. Experiment with different levels to find the best balance between compression ratio and speed for your specific data.

HISTORY

lrzip was developed by Con Kolivas to provide a long-range compression solution, capable of exploiting redundancy over much larger distances than traditional compressors. It has been maintained and improved over time. The external compressor options like lzo, gzip, bzip2, and zstd have been added to improve its use cases.

SEE ALSO

gzip(1), bzip2(1), xz(1), zstd(1), lzo(1)

Copied to clipboard