LinuxCommandLibrary
GitHubF-DroidGoogle Play Store

lz0

Compress and decompress LZ0 containers

TLDR

Compress a file at the default level
$ lz0 c input.bin output.lz0
copy
Compress at level 9 (slowest, ultra parser)
$ lz0 c -9 input.bin output.lz0
copy
Decompress a container
$ lz0 d output.lz0 restored.bin
copy

SYNOPSIS

lz0 c [-1 .. -9] input output.lz0lz0 d input.lz0 output

DESCRIPTION

lz0 is the reference command-line tool for the LZ0 compressor. LZ0 is a small LZ codec aimed at blobs from a few hundred kilobytes up to a few megabytes, with a decoder that does not allocate. This binary both compresses and decompresses. The separate lz0dec program is a decompressor only, with a benchmark mode and a choice of decoder engines.The on-disk container is an 8-byte header followed by the bitstream. The first four bytes are the ASCII magic LZ01. The next four bytes are the uncompressed size, little-endian. An empty input is stored as those eight bytes and nothing else. The compressor rejects an input of 4 GiB or larger.Build both tools from a checkout with make lz0. That writes bin/lz0 and bin/lz0dec. The Linux release tarballs ship those two names. The license is MIT. There is no install prefix in the Makefile; copy the binaries onto PATH yourself.

PARAMETERS

c [-N] input output

Compress input into an LZ01 container at output. N is a level from 1 to 9. The default level is 6. Level 9 selects the ultra parser.
d input output
Decompress an LZ01 container. The output size is taken from the container header.

CAVEATS

lz0 always takes an explicit input path and output path. It does not read stdin or write stdout, and it does not accept GNU tar-style combined flags.d checks the LZ01 magic and requires the decoded length to match the size in the header. A truncated or foreign file fails instead of writing a partial result.Level 9 is much slower than the default. Levels outside 1 through 9 are not accepted; a token such as -0 is treated as a filename and the usage line is printed.

SEE ALSO

lz0dec(1), lz4(1), zstd(1), xz(1)

RESOURCES

Copied to clipboard
Kai