1LZMA(1) General Commands Manual LZMA(1)
2
3
4
6 lzma, unlzma, lzcat - LZMA compression and decompression tool
7
8
10 lzma [-123456789cdefhkLqtvV] [-S suffix] [filenames ...]
11 unlzma [-cfhkLqtvV] [-S suffix] [filenames ...]
12 lzcat [-fhLqV] [filenames ...]
13
14
16 LZMA (Lempel-Ziv-Markov chain-Algorithm) is an improved version of
17 famous LZ77 compression algorithm. It was improved in way of maximum
18 increasing of compression ratio, keeping high decompression speed and
19 low memory requirements for decompressing.
20
21 lzma command line tool has a similar interface to gzip(1) and bzip2(1)
22 and is intended to make use of LZMA compression easy for the users who
23 are already familiar with gzip and bzip2.
24
25 In this manual lzma is compared mostly to bzip2 because that is cur‐
26 rently one of the most widely used free software to compress tar files
27 made for distribution. Comparing lzma to gzip is not practical because
28 neither lzma nor bzip2 can compete with gzip in compression speed. On
29 the other hand the compression ratio of gzip is worse than of lzma and
30 bzip2.
31
32 lzma provides notably better compression ratio than bzip2 especially
33 with files having other than plain text content. The other advantage of
34 lzma is fast decompression which is many times quicker than bzip2. The
35 major disadvantage is that achieving the highest compression ratios
36 requires extensive amount of system resources, both CPU time and RAM.
37 Also software to handle LZMA compressed files is not installed by
38 default on most distributions.
39
40 When compressing or decompressing with lzma, the new file will have the
41 same ownership information, permissions and timestamps as the original
42 file. However the this information is not stored into the compressed
43 file like gzip does.
44
45
47 LZMA files can be either streamed or non-streamed. Non-streamed files
48 are created only when the size of the file being compressed is known.
49 In practice this means that the source file must be a regular file. In
50 other words, if compressing from the standard input or from a named
51 pipe (fifo) the compressed file will always be streamed.
52
53 Both streamed and non-streamed files are compressed identically; the
54 only differences are found from the beginnings and ends of LZMA com‐
55 pressed files: Non-streamed files contain the uncompressed size of the
56 file in the LZMA file header; streamed files have uncompressed size
57 marked as unknown. To know where to stop decoding, streamed files have
58 a special End Of Stream marker at the end of the LZMA file. The EOS
59 marker makes streamed files five or six bytes bigger than non-streamed.
60
61 So in practice creating non-streamed files has two advantages: 1) the
62 compressed file is a few bytes smaller and 2) the uncompressed size of
63 the file can be checked without decompressing the file. To view the
64 data stored in the LZMA header use lzmainfo(1).
65
66
68 Short options can be grouped like -cd.
69
70 -c --stdout --to-stdout
71 The output is written to the standard output. The original files
72 are kept unchanged. When compressing to the standard output
73 there can be only one input file. This option is implied when
74 input is read from the standard input or the script is invoked
75 as lzcat.
76
77 -d --decompress --uncompress
78 Force decompression regardless of the invocation name. This the
79 default when called as unlzma or lzcat.
80
81 -f --force
82 Force compression or decompression even if source file is a sym‐
83 link, target exists, or target is a terminal. In contrast to
84 gzip and bzip2, if input data is not in LZMA format, --force
85 does not make lzma behave like cat. lzma never prompts if tar‐
86 get file should be overwritten; existing files are skipped or,
87 in case of --force, overwritten.
88
89 -h --help
90 Show a summary of supported options and quit.
91
92 -k --keep
93 Do not delete the input files after compression or decompres‐
94 sion.
95
96 -L --license
97 Show licensing information of lzma.
98
99 -q --quiet
100 Suppress all warnings. You can still check the exit status to
101 detect if a warning had been shown.
102
103 -S --suffix .suf
104 Use .suf instead of the default .lzma. A null suffix forces
105 unlzma to decompress all the given files regardless of the file‐
106 name suffix.
107
108 -t --test
109 Check the integrity of the compressed file(s). Without --verbose
110 no output is produced if no errors are found.
111
112 -v --verbose
113 Show the filename and percentage reduction of each processes
114 file.
115
116 -V --version
117 Show the version number of lzma.
118
119 -z --compress
120 Force compression regardless of the invocation name.
121
122 -1 .. -9
123 Set the compression ratio. See the next chapter for detailed
124 information. These options have no effect when decompressing.
125
126 --fast Alias to -1.
127
128 --best Alias to -9.
129
130
132 The compression options of lzma are divided to two groups. The first
133 two (-1 and -2) are designed for fast compression speed. -3 .. -9 pro‐
134 vide good to excellent compression ratio but require more CPU time and
135 system memory.
136
137 For relatively fast compression with medium compression ratio -1 is the
138 recommended setting. It's faster than 'bzip2 --fast' and usually cre‐
139 ates smaller files than 'bzip2 --best'. -2 makes somewhat smaller
140 files but doubles the compression time close to what 'bzip2 --best'
141 takes.
142
143 Generally for excellent compression ratio, acceptable compression time
144 and memory requirements (about 83 MB for compression, 9 MB for decom‐
145 pression) you should use -7 which is also the default. -8 and -9 will
146 give some gain especially with bigger files (>=tens of megabytes) but
147 also increase the CPU and memory requirements dramatically. See the ta‐
148 ble below for memory requirements of different compression settings.
149
150 Flag Compress usage Decompress usage
151 -1 2 MB 1 MB
152 -2 12 MB 2 MB
153 -3 12 MB 1 MB
154 -4 16 MB 2 MB
155 -5 26 MB 3 MB
156 -6 45 MB 5 MB
157 -7 83 MB 9 MB
158 -8 159 MB 17 MB
159 -9 311 MB 33 MB
160
161
163 Exit status:
164 0 - Everything OK.
165 1 - An error occurred.
166 2 - Something worth a warning happened but no errors.
167
168
170 The LZMA algorithm and the implementation used in LZMA utils was devel‐
171 oped by Igor Pavlov. The original code is available in LZMA SDK which
172 can be found from http://7-zip.org/sdk.html .
173
174 lzma command line tool was written by Ville Koskinen.
175 http://tukaani.org/lzma/
176
177 This manual page is inspired by manual pages of gzip and bzip2.
178
179
181 lzmadec(1), lzmainfo(1), gzip(1), bzip2(1)
182
183
184
185LZMA utils 23 Dec 2005 LZMA(1)