LZMA(1)
π LZMA(1) β the manual page, but make it make sense π
okay bestie, gather round, because this is the lzma, unlzma and lzcat situation and it's lowkey iconic. this is section 1 of the general commands manual, so it's a real tool you type at a real terminal. let's go π«Ά
β¨ NAME β¨
lzma, unlzma, lzcat β the LZMA compression and decompression tool. three names, one queen π
π SYNOPSIS π
lzma [-123456789cdefhkLqtvV] [-S suffix] [filenames ...]
unlzma [-cfhkLqtvV] [-S suffix] [filenames ...]
lzcat [-fhLqV] [filenames ...]
that's it. that's the whole vibe. β¨
πΈ DESCRIPTION πΈ
LZMA stands for Lempel-Ziv-Markov chain-Algorithm, and it's basically a glow-up of the famous LZ77 compression algorithm. the way they improved it? maxing out the compression ratio as hard as possible while still keeping decompression speedy and memory requirements for decompressing nice and low. main character energy fr π
the lzma command line tool has an interface that's super similar to gzip(1) and bzip2(1), and the whole point is to make using LZMA compression easy for anyone who's already comfy with gzip and bzip2. iykyk.
in this manual, lzma gets compared mostly to bzip2, because bzip2 is currently one of the most widely used free software tools for compressing tar files made for distribution. comparing lzma to gzip just isn't it β neither lzma nor bzip2 can compete with gzip when it comes to compression speed. but on the flip side, gzip's compression ratio is worse than lzma's and bzip2's. trade-offs, bestie π
lzma gives you notably better compression ratio than bzip2, especially with files that have content other than plain text. and the other flex? lzma decompresses fast β many times quicker than bzip2. the major L though: getting the highest compression ratios eats an extensive amount of system resources, both CPU time and RAM. also, software to handle LZMA compressed files isn't installed by default on most distributions, so like... good luck out there π
when you compress or decompress with lzma, the new file gets the same ownership information, permissions and timestamps as the original file. but heads up: this information is not stored into the compressed file the way gzip does it.
π¦ STREAMED VS. NON-STREAMED π¦
LZMA files can be either streamed or non-streamed, and this is the lore you need.
Non-streamed files are only created when the size of the file being compressed is known. in practice that means the source file must be a regular file. in other words: if you're compressing from the standard input or from a named pipe (fifo), the compressed file will always be streamed. periodt.
both streamed and non-streamed files are compressed identically β the only differences live at the beginnings and ends of LZMA compressed files:
- Non-streamed files contain the uncompressed size of the file in the LZMA file header.
- Streamed files have the uncompressed size marked as unknown.
and to know where to stop decoding, streamed files have a special End Of Stream marker at the end of the LZMA file. that EOS marker makes streamed files five or six bytes bigger than non-streamed ones. tiny but real π
so in practice, creating non-streamed files has two advantages:
- the compressed file is a few bytes smaller, and
- the uncompressed size of the file can be checked without decompressing the file.
π OPTIONS π
short options can be grouped like -cd. cute, right? π
-c,--stdout,--to-stdoutβ the output is written to the standard output. the original files are kept unchanged. when compressing to the standard output there can be only one input file. this option is implied when input is read from the standard input or the script is invoked aslzcat. the suffix is not considered in this mode.-d,--decompress,--uncompressβ force decompression regardless of the invocation name. this is the default when called asunlzmaorlzcat.-f,--forceβ force compression or decompression even if the source file is a symlink, the target exists, or the target is a terminal. in contrast togzipandbzip2, if the input data is not in LZMA format,--forcedoes not makelzmabehave likecat. andlzmanever prompts about whether the target file should be overwritten; existing files are skipped or, in the case of--force, overwritten. no takebacks π-h,--helpβ show a summary of supported options and quit.-k,--keepβ do not delete the input files after compression or decompression.-L,--licenseβ show licensing information oflzma.-q,--quietβ suppress all warnings. you can still check the exit status to detect if a warning had been shown.-S,--suffix.sufβ use.sufinstead of the default.lzma. a null suffix forcesunlzmato decompress all the given files regardless of the filename suffix.-t,--testβ check the integrity of the compressed file(s). without--verbose, no output is produced if no errors are found.-v,--verboseβ show the filename and percentage reduction of each processed file.-V,--versionβ show the version number oflzma.-z,--compressβ force compression regardless of the invocation name.-1..-9β set the compression ratio. these options have no effect when decompressing.--fastβ alias to-1.--bestβ alias to-9.
π DIAGNOSTICS π
exit status, bestie, memorize these:
0β everything OK. slay. β¨1β an error occurred. π2β something worth a warning happened but no errors.
it can be especially useful with tar(1) patched to support LZMA compression. π₯
π AUTHORS π
the LZMA algorithm and the implementation used in LZMA utils was developed by Igor Pavlov. the original code is available in LZMA SDK, which can be found from http://7-zip.org/sdk.html .
the lzma command line tool was written by Ville Koskinen. http://tukaani.org/lzma/
this manual page is inspired by the manual pages of gzip and bzip2. respect the ancestors π«Ά
π SEE ALSO π
and that's the whole page, no notes π this was LZMA utils, dated 23 Dec 2005 β yeah, she's vintage, she's still serving, and she's still called LZMA(1). bye bestie, go compress something πβ¨
π¦ where this page comes from
- debian trixie: lzma 24.08+dfsg-2 Β· lzma
- ubuntu questing: lzma 24.08+dfsg-2
- ubuntu resolute: lzma 25.00+dfsg-1 Β· lzma
- ubuntu stonking: lzma 25.00+dfsg-1 Β· lzma
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms