LinuxCommandLibrary

lzop

Compress or decompress files using LZO

TLDR

Compress a file into a new file with the .lzo suffix

$ lzop [path/to/file]
copy

Decompress a file
$ lzop [[-d|--decompress]] [path/to/file.lzo]
copy

Compress a file, while specifying the compression level. 0 = Worst, 9 = Best (Default level is 3)
$ lzop -[level] [path/to/file]
copy

Compress a file with the best compression level
$ lzop [[-9|--best]] [path/to/file]
copy

Compress a file with the fastest compression level
$ lzop [[-1|--fast]] [path/to/file]
copy

SYNOPSIS

lzop [options] [files...]
lzop -d [options] [files...]
lzop -x [options] [files...]
lzop -h | --help
lzop -V | --version

PARAMETERS

-d, --decompress
    Decompress the specified .lzo file(s).

-x, --extract
    Alias for -d; decompress and extract the file(s).

-c, --stdout
    Write output to standard output, keeping original files unchanged.

-o file, --output=file
    Specify the output filename for compressed or decompressed data. Only valid with a single input file.

-f, --force
    Force overwrite of existing output files without prompting.

-v, --verbose
    Enable verbose mode, displaying progress and additional information.

-t, --test
    Test the integrity of the compressed file(s) without decompressing.

-1 to -9
    Set the compression level. -1 is the fastest (least compression), -9 is the best compression (slowest). The default level is -3.

-S .suf, --suffix=.suf
    Specify the filename suffix for compressed files. The default suffix is .lzo.

-U, --undo
    Remove the input file if the operation (compression or decompression) was successful.

DESCRIPTION

lzop is a command-line utility for compressing and decompressing files using the LZO (Lempel-Ziv-Oberhumer) algorithm. Its primary design goal is extremely high speed, often sacrificing optimal compression ratio for faster processing. This makes it an excellent choice for applications where rapid data throughput is critical, such as processing large log files, temporary data storage, or real-time streaming where latency must be minimized.

While other tools like gzip or bzip2 might achieve smaller file sizes, lzop typically offers significantly faster compression and decompression speeds, making it ideal when CPU cycles and time are more valuable than disk space. It can operate on individual files, process data from standard input, and write to standard output, allowing seamless integration into shell scripts and pipelines.

CAVEATS

While exceptionally fast, lzop generally provides a lower compression ratio compared to other popular tools like gzip, bzip2, or xz. This trade-off means compressed files will typically be larger.

SPEED VS. COMPRESSION RATIO

The primary design principle behind lzop and the LZO algorithm is speed. It often outperforms other compression algorithms in terms of both compression and decompression speed, making it highly suitable for I/O-bound tasks or when CPU resources are abundant but time is critical. Users should be aware that this speed comes at the cost of a lower compression ratio, meaning the resulting compressed files will generally be larger than those produced by gzip, bzip2, or xz.

TYPICAL USE CASES

lzop is frequently used for:

  • Compressing large log files where fast archiving and access are more important than disk space savings.
  • Temporary data storage where data needs to be quickly written and read back.
  • Real-time data streams or embedded systems where low latency and high throughput are essential.
  • As a component in backup solutions where backup window is critical.

HISTORY

lzop is part of the LZO (Lempel-Ziv-Oberhumer) compression library, developed by Markus F.X.J. Oberhumer. The LZO algorithm and its associated tools, including lzop, were designed from the outset with a strong emphasis on speed, making them popular choices for embedded systems, real-time data processing, and applications where fast compression/decompression is paramount, rather than maximum compression density.

SEE ALSO

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

Copied to clipboard