LinuxCommandLibrary

lzma

Compress or decompress files using LZMA algorithm

TLDR

View documentation for the original command

$ tldr xz
copy

SYNOPSIS

lzma [options] [file ...]

PARAMETERS

-c, --stdout, --to-stdout
    Write to standard output; keep original files.

-d, --decompress, --uncompress
    Decompress.

-z, --compress
    Compress.

-f, --force
    Force overwrite; compress links; don't fail on broken links.

-k, --keep
    Keep (don't delete) input files.

-l, --list
    List compressed file contents.

-q, --quiet
    Suppress all warnings; force quiet operation.

-S .
    Use suffix . on compressed files.

-v, --verbose
    Verbose mode.

-h, --help
    Display help and exit.

-V, --version
    Display version information and exit.

-0 ... -9
    Compression level 0 (fastest) to 9 (best, but slower).

DESCRIPTION

The lzma utility is a command-line tool used for compressing and decompressing files using the LZMA (Lempel-Ziv-Markov chain Algorithm) compression algorithm. It provides a higher compression ratio compared to older methods like gzip, while often maintaining reasonable compression/decompression speeds. lzma can compress single files or, in conjunction with tar, entire directories. It's a commonly used tool for archiving and distributing software packages and data archives,
The lzma format is a single file format, so multiple files needs to be handled by archive managers like tar,
By default, lzma will delete the original file after successful compression or decompression. This behaviour can be prevented with command-line options. Decompression automatically detects if the input is a .lzma file and decompresses it.

CAVEATS

The default behavior of deleting the original file can be dangerous if the compression process fails for any reason. Always consider using the '-k' option to keep the original file until you've verified the compressed file is valid.

EXIT STATUS

The exit status is 0 on successful completion, and non-zero for errors.

HISTORY

LZMA (Lempel-Ziv-Markov chain Algorithm) was initially developed by Igor Pavlov as part of the 7-Zip project. Its integration into Linux systems came later as a way to offer a higher compression ratio compared to existing methods like gzip and bzip2. The command-line lzma utility provides a convenient interface for leveraging this algorithm. Over time, xz, which uses LZMA2 (an updated version of LZMA), has become more prevalent, often replacing lzma in many distributions, though lzma remains available for compatibility with older LZMA archives.
lzma is part of the lzma SDK (Software development kit), a software library for compression.

SEE ALSO

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

Copied to clipboard