]> icculus.org git repositories - icculus/xz.git/blob - src/xz/xz.1
3520d0f9ace64715c717ac658397f79448119479
[icculus/xz.git] / src / xz / xz.1
1 '\" t
2 .\"
3 .\" Author: Lasse Collin
4 .\"
5 .\" This file has been put into the public domain.
6 .\" You can do whatever you want with this file.
7 .\"
8 .TH XZ 1 "2010-06-01" "Tukaani" "XZ Utils"
9 .SH NAME
10 xz, unxz, xzcat, lzma, unlzma, lzcat \- Compress or decompress .xz and .lzma files
11 .SH SYNOPSIS
12 .B xz
13 .RI [ option ]...
14 .RI [ file ]...
15 .PP
16 .B unxz
17 is equivalent to
18 .BR "xz \-\-decompress" .
19 .br
20 .B xzcat
21 is equivalent to
22 .BR "xz \-\-decompress \-\-stdout" .
23 .br
24 .B lzma
25 is equivalent to
26 .BR "xz \-\-format=lzma" .
27 .br
28 .B unlzma
29 is equivalent to
30 .BR "xz \-\-format=lzma \-\-decompress" .
31 .br
32 .B lzcat
33 is equivalent to
34 .BR "xz \-\-format=lzma \-\-decompress \-\-stdout" .
35 .PP
36 When writing scripts that need to decompress files, it is recommended to
37 always use the name
38 .B xz
39 with appropriate arguments
40 .RB ( "xz \-d"
41 or
42 .BR "xz \-dc" )
43 instead of the names
44 .B unxz
45 and
46 .BR xzcat.
47 .SH DESCRIPTION
48 .B xz
49 is a general-purpose data compression tool with command line syntax similar to
50 .BR gzip (1)
51 and
52 .BR bzip2 (1).
53 The native file format is the
54 .B .xz
55 format, but also the legacy
56 .B .lzma
57 format and raw compressed streams with no container format headers
58 are supported.
59 .PP
60 .B xz
61 compresses or decompresses each
62 .I file
63 according to the selected operation mode.
64 If no
65 .I files
66 are given or
67 .I file
68 is
69 .BR \- ,
70 .B xz
71 reads from standard input and writes the processed data to standard output.
72 .B xz
73 will refuse (display an error and skip the
74 .IR file )
75 to write compressed data to standard output if it is a terminal. Similarly,
76 .B xz
77 will refuse to read compressed data from standard input if it is a terminal.
78 .PP
79 Unless
80 .B \-\-stdout
81 is specified,
82 .I files
83 other than
84 .B \-
85 are written to a new file whose name is derived from the source
86 .I file
87 name:
88 .IP \(bu 3
89 When compressing, the suffix of the target file format
90 .RB ( .xz
91 or
92 .BR .lzma )
93 is appended to the source filename to get the target filename.
94 .IP \(bu 3
95 When decompressing, the
96 .B .xz
97 or
98 .B .lzma
99 suffix is removed from the filename to get the target filename.
100 .B xz
101 also recognizes the suffixes
102 .B .txz
103 and
104 .BR .tlz ,
105 and replaces them with the
106 .B .tar
107 suffix.
108 .PP
109 If the target file already exists, an error is displayed and the
110 .I file
111 is skipped.
112 .PP
113 Unless writing to standard output,
114 .B xz
115 will display a warning and skip the
116 .I file
117 if any of the following applies:
118 .IP \(bu 3
119 .I File
120 is not a regular file. Symbolic links are not followed, thus they
121 are not considered to be regular files.
122 .IP \(bu 3
123 .I File
124 has more than one hard link.
125 .IP \(bu 3
126 .I File
127 has setuid, setgid, or sticky bit set.
128 .IP \(bu 3
129 The operation mode is set to compress, and the
130 .I file
131 already has a suffix of the target file format
132 .RB ( .xz
133 or
134 .B .txz
135 when compressing to the
136 .B .xz
137 format, and
138 .B .lzma
139 or
140 .B .tlz
141 when compressing to the
142 .B .lzma
143 format).
144 .IP \(bu 3
145 The operation mode is set to decompress, and the
146 .I file
147 doesn't have a suffix of any of the supported file formats
148 .RB ( .xz ,
149 .BR .txz ,
150 .BR .lzma ,
151 or
152 .BR .tlz ).
153 .PP
154 After successfully compressing or decompressing the
155 .IR file ,
156 .B xz
157 copies the owner, group, permissions, access time, and modification time
158 from the source
159 .I file
160 to the target file. If copying the group fails, the permissions are modified
161 so that the target file doesn't become accessible to users who didn't have
162 permission to access the source
163 .IR file .
164 .B xz
165 doesn't support copying other metadata like access control lists
166 or extended attributes yet.
167 .PP
168 Once the target file has been successfully closed, the source
169 .I file
170 is removed unless
171 .B \-\-keep
172 was specified. The source
173 .I file
174 is never removed if the output is written to standard output.
175 .PP
176 Sending
177 .B SIGINFO
178 or
179 .B SIGUSR1
180 to the
181 .B xz
182 process makes it print progress information to standard error.
183 This has only limited use since when standard error is a terminal, using
184 .B \-\-verbose
185 will display an automatically updating progress indicator.
186 .SS "Memory usage"
187 The memory usage of
188 .B xz
189 varies from a few hundred kilobytes to several gigabytes depending on
190 the compression settings. The settings used when compressing a file
191 affect also the memory usage of the decompressor. Typically the decompressor
192 needs only 5\ % to 20\ % of the amount of RAM that the compressor needed when
193 creating the file. Still, the worst-case memory usage of the decompressor
194 is several gigabytes.
195 .PP
196 To prevent uncomfortable surprises caused by huge memory usage,
197 .B xz
198 has a built-in memory usage limiter. While some operating systems provide
199 ways to limit the memory usage of processes, relying on it wasn't deemed
200 to be flexible enough. The default limit depends on the total amount of
201 physical RAM:
202 .IP \(bu 3
203 If 40\ % of RAM is at least 80 MiB, 40\ % of RAM is used as the limit.
204 .IP \(bu 3
205 If 80\ % of RAM is less than 80 MiB, 80\ % of RAM is used as the limit.
206 .IP \(bu 3
207 Otherwise 80 MiB is used as the limit.
208 .PP
209 When compressing, if the selected compression settings exceed the memory
210 usage limit, the settings are automatically adjusted downwards and a notice
211 about this is displayed. As an exception, if the memory usage limit is
212 exceeded when compressing with
213 .BR \-\-format=raw ,
214 an error is displayed and
215 .B xz
216 will exit with exit status
217 .BR 1 .
218 .PP
219 If source
220 .I file
221 cannot be decompressed without exceeding the memory usage limit, an error
222 message is displayed and the file is skipped. Note that compressed files
223 may contain many blocks, which may have been compressed with different
224 settings. Typically all blocks will have roughly the same memory requirements,
225 but it is possible that a block later in the file will exceed the memory usage
226 limit, and an error about too low memory usage limit gets displayed after some
227 data has already been decompressed.
228 .PP
229 The absolute value of the active memory usage limit can be seen with
230 .B \-\-info-memory
231 or near the bottom of the output of
232 .BR \-\-long\-help .
233 The default limit can be overridden with
234 \fB\-\-memory=\fIlimit\fR.
235 .SS Concatenation and padding with .xz files
236 It is possible to concatenate
237 .B .xz
238 files as is.
239 .B xz
240 will decompress such files as if they were a single
241 .B .xz
242 file.
243 .PP
244 It is possible to insert padding between the concenated parts
245 or after the last part. The padding must be null bytes and the size
246 of the padding must be a multiple of four bytes. This can be useful
247 if the .xz file is stored on a medium that stores file sizes
248 e.g. as 512-byte blocks.
249 .PP
250 Concatenation and padding are not allowed with
251 .B .lzma
252 files or raw streams.
253 .SH OPTIONS
254 .SS "Integer suffixes and special values"
255 In most places where an integer argument is expected, an optional suffix
256 is supported to easily indicate large integers. There must be no space
257 between the integer and the suffix.
258 .TP
259 .B KiB
260 The integer is multiplied by 1,024 (2^10). Also
261 .BR Ki ,
262 .BR k ,
263 .BR kB ,
264 .BR K ,
265 and
266 .B KB
267 are accepted as synonyms for
268 .BR KiB .
269 .TP
270 .B MiB
271 The integer is multiplied by 1,048,576 (2^20). Also
272 .BR Mi ,
273 .BR m ,
274 .BR M ,
275 and
276 .B MB
277 are accepted as synonyms for
278 .BR MiB .
279 .TP
280 .B GiB
281 The integer is multiplied by 1,073,741,824 (2^30). Also
282 .BR Gi ,
283 .BR g ,
284 .BR G ,
285 and
286 .B GB
287 are accepted as synonyms for
288 .BR GiB .
289 .PP
290 A special value
291 .B max
292 can be used to indicate the maximum integer value supported by the option.
293 .SS "Operation mode"
294 If multiple operation mode options are given, the last one takes effect.
295 .TP
296 .BR \-z ", " \-\-compress
297 Compress. This is the default operation mode when no operation mode option
298 is specified, and no other operation mode is implied from the command name
299 (for example,
300 .B unxz
301 implies
302 .BR \-\-decompress ).
303 .TP
304 .BR \-d ", " \-\-decompress ", " \-\-uncompress
305 Decompress.
306 .TP
307 .BR \-t ", " \-\-test
308 Test the integrity of compressed
309 .IR files .
310 No files are created or removed. This option is equivalent to
311 .B "\-\-decompress \-\-stdout"
312 except that the decompressed data is discarded instead of being
313 written to standard output.
314 .TP
315 .BR \-l ", " \-\-list
316 List information about compressed
317 .IR files .
318 No uncompressed output is produced, and no files are created or removed.
319 In list mode, the program cannot read the compressed data from standard
320 input or from other unseekable sources.
321 .IP
322 The default listing shows basic information about
323 .IR files ,
324 one file per line. To get more detailed information, use also the
325 .B \-\-verbose
326 option. For even more information, use
327 .B \-\-verbose
328 twice, but note that it may be slow, because getting all the extra
329 information requires many seeks. The width of verbose output exceeds
330 80 characters, so piping the output to e.g.
331 .B "less\ \-S"
332 may be convenient if the terminal isn't wide enough.
333 .IP
334 The exact output may vary between
335 .B xz
336 versions and different locales. To get machine-readable output,
337 .B \-\-robot \-\-list
338 should be used.
339 .SS "Operation modifiers"
340 .TP
341 .BR \-k ", " \-\-keep
342 Keep (don't delete) the input files.
343 .TP
344 .BR \-f ", " \-\-force
345 This option has several effects:
346 .RS
347 .IP \(bu 3
348 If the target file already exists, delete it before compressing or
349 decompressing.
350 .IP \(bu 3
351 Compress or decompress even if the input is a symbolic link to a regular file,
352 has more than one hard link, or has setuid, setgid, or sticky bit set.
353 The setuid, setgid, and sticky bits are not copied to the target file.
354 .IP \(bu 3
355 If combined with
356 .B \-\-decompress
357 .BR \-\-stdout
358 and
359 .B xz
360 doesn't recognize the type of the source file,
361 .B xz
362 will copy the source file as is to standard output. This allows using
363 .B xzcat
364 .B \--force
365 like
366 .BR cat (1)
367 for files that have not been compressed with
368 .BR xz .
369 Note that in future,
370 .B xz
371 might support new compressed file formats, which may make
372 .B xz
373 decompress more types of files instead of copying them as is to
374 standard output.
375 .BI \-\-format= format
376 can be used to restrict
377 .B xz
378 to decompress only a single file format.
379 .RE
380 .TP
381 .BR \-c ", " \-\-stdout ", " \-\-to-stdout
382 Write the compressed or decompressed data to standard output instead of
383 a file. This implies
384 .BR \-\-keep .
385 .TP
386 .B \-\-no\-sparse
387 Disable creation of sparse files. By default, if decompressing into
388 a regular file,
389 .B xz
390 tries to make the file sparse if the decompressed data contains long
391 sequences of binary zeros. It works also when writing to standard output
392 as long as standard output is connected to a regular file, and certain
393 additional conditions are met to make it safe. Creating sparse files may
394 save disk space and speed up the decompression by reducing the amount of
395 disk I/O.
396 .TP
397 \fB\-S\fR \fI.suf\fR, \fB\-\-suffix=\fI.suf
398 When compressing, use
399 .I .suf
400 as the suffix for the target file instead of
401 .B .xz
402 or
403 .BR .lzma .
404 If not writing to standard output and the source file already has the suffix
405 .IR .suf ,
406 a warning is displayed and the file is skipped.
407 .IP
408 When decompressing, recognize also files with the suffix
409 .I .suf
410 in addition to files with the
411 .BR .xz ,
412 .BR .txz ,
413 .BR .lzma ,
414 or
415 .B .tlz
416 suffix. If the source file has the suffix
417 .IR .suf ,
418 the suffix is removed to get the target filename.
419 .IP
420 When compressing or decompressing raw streams
421 .RB ( \-\-format=raw ),
422 the suffix must always be specified unless writing to standard output,
423 because there is no default suffix for raw streams.
424 .TP
425 \fB\-\-files\fR[\fB=\fIfile\fR]
426 Read the filenames to process from
427 .IR file ;
428 if
429 .I file
430 is omitted, filenames are read from standard input. Filenames must be
431 terminated with the newline character. A dash
432 .RB ( \- )
433 is taken as a regular filename; it doesn't mean standard input.
434 If filenames are given also as command line arguments, they are
435 processed before the filenames read from
436 .IR file .
437 .TP
438 \fB\-\-files0\fR[\fB=\fIfile\fR]
439 This is identical to \fB\-\-files\fR[\fB=\fIfile\fR] except that the
440 filenames must be terminated with the null character.
441 .SS "Basic file format and compression options"
442 .TP
443 \fB\-F\fR \fIformat\fR, \fB\-\-format=\fIformat
444 Specify the file format to compress or decompress:
445 .RS
446 .IP \(bu 3
447 .BR auto :
448 This is the default. When compressing,
449 .B auto
450 is equivalent to
451 .BR xz .
452 When decompressing, the format of the input file is automatically detected.
453 Note that raw streams (created with
454 .BR \-\-format=raw )
455 cannot be auto-detected.
456 .IP \(bu 3
457 .BR xz :
458 Compress to the
459 .B .xz
460 file format, or accept only
461 .B .xz
462 files when decompressing.
463 .IP \(bu 3
464 .B lzma
465 or
466 .BR alone :
467 Compress to the legacy
468 .B .lzma
469 file format, or accept only
470 .B .lzma
471 files when decompressing. The alternative name
472 .B alone
473 is provided for backwards compatibility with LZMA Utils.
474 .IP \(bu 3
475 .BR raw :
476 Compress or uncompress a raw stream (no headers). This is meant for advanced
477 users only. To decode raw streams, you need to set not only
478 .B \-\-format=raw
479 but also specify the filter chain, which would normally be stored in the
480 container format headers.
481 .RE
482 .TP
483 \fB\-C\fR \fIcheck\fR, \fB\-\-check=\fIcheck
484 Specify the type of the integrity check, which is calculated from the
485 uncompressed data. This option has an effect only when compressing into the
486 .B .xz
487 format; the
488 .B .lzma
489 format doesn't support integrity checks.
490 The integrity check (if any) is verified when the
491 .B .xz
492 file is decompressed.
493 .IP
494 Supported
495 .I check
496 types:
497 .RS
498 .IP \(bu 3
499 .BR none :
500 Don't calculate an integrity check at all. This is usually a bad idea. This
501 can be useful when integrity of the data is verified by other means anyway.
502 .IP \(bu 3
503 .BR crc32 :
504 Calculate CRC32 using the polynomial from IEEE-802.3 (Ethernet).
505 .IP \(bu 3
506 .BR crc64 :
507 Calculate CRC64 using the polynomial from ECMA-182. This is the default, since
508 it is slightly better than CRC32 at detecting damaged files and the speed
509 difference is negligible.
510 .IP \(bu 3
511 .BR sha256 :
512 Calculate SHA-256. This is somewhat slower than CRC32 and CRC64.
513 .RE
514 .IP
515 Integrity of the
516 .B .xz
517 headers is always verified with CRC32. It is not possible to change or
518 disable it.
519 .TP
520 .BR \-0 " ... " \-9
521 Select compression preset. If a preset level is specified multiple times,
522 the last one takes effect.
523 .IP
524 The compression preset levels can be categorised roughly into three
525 categories:
526 .RS
527 .IP "\fB\-0\fR ... \fB\-2"
528 Fast presets with relatively low memory usage.
529 .B \-1
530 and
531 .B \-2
532 should give compression speed and ratios comparable to
533 .B "bzip2 \-1"
534 and
535 .BR "bzip2 \-9" ,
536 respectively.
537 Currently
538 .B \-0
539 is not very good (not much faster than
540 .B \-1
541 but much worse compression). In future,
542 .B \-0
543 may be indicate some fast algorithm instead of LZMA2.
544 .IP "\fB\-3\fR ... \fB\-5"
545 Good compression ratio with low to medium memory usage.
546 These are significantly slower than levels 0\-2.
547 .IP "\fB\-6\fR ... \fB\-9"
548 Excellent compression with medium to high memory usage. These are also
549 slower than the lower preset levels. The default is
550 .BR \-6 .
551 Unless you want to maximize the compression ratio, you probably don't want
552 a higher preset level than
553 .B \-7
554 due to speed and memory usage.
555 .RE
556 .IP
557 The exact compression settings (filter chain) used by each preset may
558 vary between
559 .B xz
560 versions. The settings may also vary between files being compressed, if
561 .B xz
562 determines that modified settings will probably give better compression
563 ratio without significantly affecting compression time or memory usage.
564 .IP
565 Because the settings may vary, the memory usage may vary too. The following
566 table lists the maximum memory usage of each preset level, which won't be
567 exceeded even in future versions of
568 .BR xz .
569 .IP
570 .B "FIXME: The table below is just a rough idea."
571 .RS
572 .RS
573 .TS
574 tab(;);
575 c c c
576 n n n.
577 Preset;Compression;Decompression
578 \-0;6 MiB;1 MiB
579 \-1;6 MiB;1 MiB
580 \-2;10 MiB;1 MiB
581 \-3;20 MiB;2 MiB
582 \-4;30 MiB;3 MiB
583 \-5;60 MiB;6 MiB
584 \-6;100 MiB;10 MiB
585 \-7;200 MiB;20 MiB
586 \-8;400 MiB;40 MiB
587 \-9;800 MiB;80 MiB
588 .TE
589 .RE
590 .RE
591 .IP
592 When compressing,
593 .B xz
594 automatically adjusts the compression settings downwards if
595 the memory usage limit would be exceeded, so it is safe to specify
596 a high preset level even on systems that don't have lots of RAM.
597 .TP
598 .BR \-\-fast " and " \-\-best
599 These are somewhat misleading aliases for
600 .B \-0
601 and
602 .BR \-9 ,
603 respectively.
604 These are provided only for backwards compatibility with LZMA Utils.
605 Avoid using these options.
606 .IP
607 Especially the name of
608 .B \-\-best
609 is misleading, because the definition of best depends on the input data,
610 and that usually people don't want the very best compression ratio anyway,
611 because it would be very slow.
612 .TP
613 .BR \-e ", " \-\-extreme
614 Modify the compression preset (\fB\-0\fR ... \fB\-9\fR) so that a little bit
615 better compression ratio can be achieved without increasing memory usage
616 of the compressor or decompressor (exception: compressor memory usage may
617 increase a little with presets \fB\-0\fR ... \fB\-2\fR). The downside is that
618 the compression time will increase dramatically (it can easily double).
619 .TP
620 \fB\-M\fR \fIlimit\fR, \fB\-\-memory=\fIlimit
621 Set the memory usage limit. If this option is specified multiple times,
622 the last one takes effect. The
623 .I limit
624 can be specified in multiple ways:
625 .RS
626 .IP \(bu 3
627 The
628 .I limit
629 can be an absolute value in bytes. Using an integer suffix like
630 .B MiB
631 can be useful. Example:
632 .B "\-\-memory=80MiB"
633 .IP \(bu 3
634 The
635 .I limit
636 can be specified as a percentage of physical RAM. Example:
637 .B "\-\-memory=70%"
638 .IP \(bu 3
639 The
640 .I limit
641 can be reset back to its default value by setting it to
642 .BR 0 .
643 See the section
644 .B "Memory usage"
645 for how the default limit is defined.
646 .IP \(bu 3
647 The memory usage limiting can be effectively disabled by setting
648 .I limit
649 to
650 .BR max .
651 This isn't recommended. It's usually better to use, for example,
652 .BR \-\-memory=90% .
653 .RE
654 .IP
655 The current
656 .I limit
657 can be seen near the bottom of the output of the
658 .B \-\-long-help
659 option.
660 .TP
661 \fB\-T\fR \fIthreads\fR, \fB\-\-threads=\fIthreads
662 Specify the maximum number of worker threads to use. The default is
663 the number of available CPU cores. You can see the current value of
664 .I threads
665 near the end of the output of the
666 .B \-\-long\-help
667 option.
668 .IP
669 The actual number of worker threads can be less than
670 .I threads
671 if using more threads would exceed the memory usage limit.
672 In addition to CPU-intensive worker threads,
673 .B xz
674 may use a few auxiliary threads, which don't use a lot of CPU time.
675 .IP
676 .B "Multithreaded compression and decompression are not implemented yet,"
677 .B "so this option has no effect for now."
678 .SS Custom compressor filter chains
679 A custom filter chain allows specifying the compression settings in detail
680 instead of relying on the settings associated to the preset levels.
681 When a custom filter chain is specified, the compression preset level options
682 (\fB\-0\fR ... \fB\-9\fR and \fB\-\-extreme\fR) are silently ignored.
683 .PP
684 A filter chain is comparable to piping on the UN*X command line.
685 When compressing, the uncompressed input goes to the first filter, whose
686 output goes to the next filter (if any). The output of the last filter
687 gets written to the compressed file. The maximum number of filters in
688 the chain is four, but typically a filter chain has only one or two filters.
689 .PP
690 Many filters have limitations where they can be in the filter chain:
691 some filters can work only as the last filter in the chain, some only
692 as a non-last filter, and some work in any position in the chain. Depending
693 on the filter, this limitation is either inherent to the filter design or
694 exists to prevent security issues.
695 .PP
696 A custom filter chain is specified by using one or more filter options in
697 the order they are wanted in the filter chain. That is, the order of filter
698 options is significant! When decoding raw streams
699 .RB ( \-\-format=raw ),
700 the filter chain is specified in the same order as it was specified when
701 compressing.
702 .PP
703 Filters take filter-specific
704 .I options
705 as a comma-separated list. Extra commas in
706 .I options
707 are ignored. Every option has a default value, so you need to
708 specify only those you want to change.
709 .TP
710 \fB\-\-lzma1\fR[\fB=\fIoptions\fR], \fB\-\-lzma2\fR[\fB=\fIoptions\fR]
711 Add LZMA1 or LZMA2 filter to the filter chain. These filter can be used
712 only as the last filter in the chain.
713 .IP
714 LZMA1 is a legacy filter, which is supported almost solely due to the legacy
715 .B .lzma
716 file format, which supports only LZMA1. LZMA2 is an updated
717 version of LZMA1 to fix some practical issues of LZMA1. The
718 .B .xz
719 format uses LZMA2, and doesn't support LZMA1 at all. Compression speed and
720 ratios of LZMA1 and LZMA2 are practically the same.
721 .IP
722 LZMA1 and LZMA2 share the same set of
723 .IR options :
724 .RS
725 .TP
726 .BI preset= preset
727 Reset all LZMA1 or LZMA2
728 .I options
729 to
730 .IR preset .
731 .I Preset
732 consist of an integer, which may be followed by single-letter preset
733 modifiers. The integer can be from
734 .B 0
735 to
736 .BR 9 ,
737 matching the command line options \fB\-0\fR ... \fB\-9\fR.
738 The only supported modifier is currently
739 .BR e ,
740 which matches
741 .BR \-\-extreme .
742 .IP
743 The default
744 .I preset
745 is
746 .BR 6 ,
747 from which the default values for the rest of the LZMA1 or LZMA2
748 .I options
749 are taken.
750 .TP
751 .BI dict= size
752 Dictionary (history buffer) size indicates how many bytes of the recently
753 processed uncompressed data is kept in memory. One method to reduce size of
754 the uncompressed data is to store distance-length pairs, which
755 indicate what data to repeat from the dictionary buffer. The bigger
756 the dictionary, the better the compression ratio usually is,
757 but dictionaries bigger than the uncompressed data are waste of RAM.
758 .IP
759 Typical dictionary size is from 64 KiB to 64 MiB. The minimum is 4 KiB.
760 The maximum for compression is currently 1.5 GiB. The decompressor already
761 supports dictionaries up to one byte less than 4 GiB, which is the
762 maximum for LZMA1 and LZMA2 stream formats.
763 .IP
764 Dictionary size has the biggest effect on compression ratio.
765 Dictionary size and match finder together determine the memory usage of
766 the LZMA1 or LZMA2 encoder. The same dictionary size is required
767 for decompressing that was used when compressing, thus the memory usage of
768 the decoder is determined by the dictionary size used when compressing.
769 .TP
770 .BI lc= lc
771 Specify the number of literal context bits. The minimum is
772 .B 0
773 and the maximum is
774 .BR 4 ;
775 the default is
776 .BR 3 .
777 In addition, the sum of
778 .I lc
779 and
780 .I lp
781 must not exceed
782 .BR 4 .
783 .TP
784 .BI lp= lp
785 Specify the number of literal position bits. The minimum is
786 .B 0
787 and the maximum is
788 .BR 4 ;
789 the default is
790 .BR 0 .
791 .TP
792 .BI pb= pb
793 Specify the number of position bits. The minimum is
794 .B 0
795 and the maximum is
796 .BR 4 ;
797 the default is
798 .BR 2 .
799 .TP
800 .BI mode= mode
801 Compression
802 .I mode
803 specifies the function used to analyze the data produced by the match finder.
804 Supported
805 .I modes
806 are
807 .B fast
808 and
809 .BR normal .
810 The default is
811 .B fast
812 for
813 .I presets
814 .BR 0 \- 2
815 and
816 .B normal
817 for
818 .I presets
819 .BR 3 \- 9 .
820 .TP
821 .BI mf= mf
822 Match finder has a major effect on encoder speed, memory usage, and
823 compression ratio. Usually Hash Chain match finders are faster than
824 Binary Tree match finders. Hash Chains are usually used together with
825 .B mode=fast
826 and Binary Trees with
827 .BR mode=normal .
828 The memory usage formulas are only rough estimates,
829 which are closest to reality when
830 .I dict
831 is a power of two.
832 .RS
833 .TP
834 .B hc3
835 Hash Chain with 2- and 3-byte hashing
836 .br
837 Minimum value for
838 .IR nice :
839 3
840 .br
841 Memory usage:
842 .I dict
843 * 7.5 (if
844 .I dict
845 <= 16 MiB);
846 .br
847 .I dict
848 * 5.5 + 64 MiB (if
849 .I dict
850 > 16 MiB)
851 .TP
852 .B hc4
853 Hash Chain with 2-, 3-, and 4-byte hashing
854 .br
855 Minimum value for
856 .IR nice :
857 4
858 .br
859 Memory usage:
860 .I dict
861 * 7.5
862 .TP
863 .B bt2
864 Binary Tree with 2-byte hashing
865 .br
866 Minimum value for
867 .IR nice :
868 2
869 .br
870 Memory usage:
871 .I dict
872 * 9.5
873 .TP
874 .B bt3
875 Binary Tree with 2- and 3-byte hashing
876 .br
877 Minimum value for
878 .IR nice :
879 3
880 .br
881 Memory usage:
882 .I dict
883 * 11.5 (if
884 .I dict
885 <= 16 MiB);
886 .br
887 .I dict
888 * 9.5 + 64 MiB (if
889 .I dict
890 > 16 MiB)
891 .TP
892 .B bt4
893 Binary Tree with 2-, 3-, and 4-byte hashing
894 .br
895 Minimum value for
896 .IR nice :
897 4
898 .br
899 Memory usage:
900 .I dict
901 * 11.5
902 .RE
903 .TP
904 .BI nice= nice
905 Specify what is considered to be a nice length for a match. Once a match
906 of at least
907 .I nice
908 bytes is found, the algorithm stops looking for possibly better matches.
909 .IP
910 .I nice
911 can be 2\-273 bytes. Higher values tend to give better compression ratio
912 at expense of speed. The default depends on the
913 .I preset
914 level.
915 .TP
916 .BI depth= depth
917 Specify the maximum search depth in the match finder. The default is the
918 special value
919 .BR 0 ,
920 which makes the compressor determine a reasonable
921 .I depth
922 from
923 .I mf
924 and
925 .IR nice .
926 .IP
927 Using very high values for
928 .I depth
929 can make the encoder extremely slow with carefully crafted files.
930 Avoid setting the
931 .I depth
932 over 1000 unless you are prepared to interrupt the compression in case it
933 is taking too long.
934 .RE
935 .IP
936 When decoding raw streams
937 .RB ( \-\-format=raw ),
938 LZMA2 needs only the value of
939 .BR dict .
940 LZMA1 needs also
941 .BR lc ,
942 .BR lp ,
943 and
944 .BR pb.
945 .TP
946 \fB\-\-x86\fR[\fB=\fIoptions\fR]
947 .TP
948 \fB\-\-powerpc\fR[\fB=\fIoptions\fR]
949 .TP
950 \fB\-\-ia64\fR[\fB=\fIoptions\fR]
951 .TP
952 \fB\-\-arm\fR[\fB=\fIoptions\fR]
953 .TP
954 \fB\-\-armthumb\fR[\fB=\fIoptions\fR]
955 .TP
956 \fB\-\-sparc\fR[\fB=\fIoptions\fR]
957 Add a branch/call/jump (BCJ) filter to the filter chain. These filters
958 can be used only as non-last filter in the filter chain.
959 .IP
960 A BCJ filter converts relative addresses in the machine code to their
961 absolute counterparts. This doesn't change the size of the data, but
962 it increases redundancy, which allows e.g. LZMA2 to get better
963 compression ratio.
964 .IP
965 The BCJ filters are always reversible, so using a BCJ filter for wrong
966 type of data doesn't cause any data loss. However, applying a BCJ filter
967 for wrong type of data is a bad idea, because it tends to make the
968 compression ratio worse.
969 .IP
970 Different instruction sets have have different alignment:
971 .RS
972 .RS
973 .TS
974 tab(;);
975 l n l
976 l n l.
977 Filter;Alignment;Notes
978 x86;1;32-bit and 64-bit x86
979 PowerPC;4;Big endian only
980 ARM;4;Little endian only
981 ARM-Thumb;2;Little endian only
982 IA-64;16;Big or little endian
983 SPARC;4;Big or little endian
984 .TE
985 .RE
986 .RE
987 .IP
988 Since the BCJ-filtered data is usually compressed with LZMA2, the compression
989 ratio may be improved slightly if the LZMA2 options are set to match the
990 alignment of the selected BCJ filter. For example, with the IA-64 filter,
991 it's good to set
992 .B pb=4
993 with LZMA2 (2^4=16). The x86 filter is an exception; it's usually good to
994 stick to LZMA2's default four-byte alignment when compressing x86 executables.
995 .IP
996 All BCJ filters support the same
997 .IR options :
998 .RS
999 .TP
1000 .BI start= offset
1001 Specify the start
1002 .I offset
1003 that is used when converting between relative and absolute addresses.
1004 The
1005 .I offset
1006 must be a multiple of the alignment of the filter (see the table above).
1007 The default is zero. In practice, the default is good; specifying
1008 a custom
1009 .I offset
1010 is almost never useful.
1011 .IP
1012 Specifying a non-zero start
1013 .I offset
1014 is probably useful only if the executable has multiple sections, and there
1015 are many cross-section jumps or calls. Applying a BCJ filter separately for
1016 each section with proper start offset and then compressing the result as
1017 a single chunk may give some improvement in compression ratio compared
1018 to applying the BCJ filter with the default
1019 .I offset
1020 for the whole executable.
1021 .RE
1022 .TP
1023 \fB\-\-delta\fR[\fB=\fIoptions\fR]
1024 Add Delta filter to the filter chain. The Delta filter
1025 can be used only as non-last filter in the filter chain.
1026 .IP
1027 Currently only simple byte-wise delta calculation is supported. It can
1028 be useful when compressing e.g. uncompressed bitmap images or uncompressed
1029 PCM audio. However, special purpose algorithms may give significantly better
1030 results than Delta + LZMA2. This is true especially with audio, which
1031 compresses faster and better e.g. with FLAC.
1032 .IP
1033 Supported
1034 .IR options :
1035 .RS
1036 .TP
1037 .BI dist= distance
1038 Specify the
1039 .I distance
1040 of the delta calculation as bytes.
1041 .I distance
1042 must be 1\-256. The default is 1.
1043 .IP
1044 For example, with
1045 .B dist=2
1046 and eight-byte input A1 B1 A2 B3 A3 B5 A4 B7, the output will be
1047 A1 B1 01 02 01 02 01 02.
1048 .RE
1049 .SS "Other options"
1050 .TP
1051 .BR \-q ", " \-\-quiet
1052 Suppress warnings and notices. Specify this twice to suppress errors too.
1053 This option has no effect on the exit status. That is, even if a warning
1054 was suppressed, the exit status to indicate a warning is still used.
1055 .TP
1056 .BR \-v ", " \-\-verbose
1057 Be verbose. If standard error is connected to a terminal,
1058 .B xz
1059 will display a progress indicator.
1060 Specifying
1061 .B \-\-verbose
1062 twice will give even more verbose output (useful mostly for debugging).
1063 .IP
1064 The progress indicator shows the following information:
1065 .RS
1066 .IP \(bu 3
1067 Completion percentage is shown if the size of the input file is known.
1068 That is, percentage cannot be shown in pipes.
1069 .IP \(bu 3
1070 Amount of compressed data produced (compressing) or consumed (decompressing).
1071 .IP \(bu 3
1072 Amount of uncompressed data consumed (compressing) or produced
1073 (decompressing).
1074 .IP \(bu 3
1075 Compression ratio, which is calculated by dividing the amount of
1076 compressed data processed so far by the amount of uncompressed data
1077 processed so far.
1078 .IP \(bu 3
1079 Compression or decompression speed. This is measured as the amount of
1080 uncompressed data consumed (compression) or produced (decompression)
1081 per second. It is shown once a few seconds have passed since
1082 .B xz
1083 started processing the file.
1084 .IP \(bu 3
1085 Elapsed time or estimated time remaining.
1086 Elapsed time is displayed in the format M:SS or H:MM:SS.
1087 The estimated remaining time is displayed in a less precise format
1088 which never has colons, for example, 2 min 30 s. The estimate can
1089 be shown only when the size of the input file is known and a couple of
1090 seconds have already passed since
1091 .B xz
1092 started processing the file.
1093 .RE
1094 .IP
1095 When standard error is not a terminal,
1096 .B \-\-verbose
1097 will make
1098 .B xz
1099 print the filename, compressed size, uncompressed size, compression ratio,
1100 speed, and elapsed time on a single line to standard error after
1101 compressing or decompressing the file. If operating took at least a few
1102 seconds, also the speed and elapsed time are printed. If the operation
1103 didn't finish, for example due to user interruption, also the completion
1104 percentage is printed if the size of the input file is known.
1105 .TP
1106 .BR \-Q ", " \-\-no\-warn
1107 Don't set the exit status to
1108 .B 2
1109 even if a condition worth a warning was detected. This option doesn't affect
1110 the verbosity level, thus both
1111 .B \-\-quiet
1112 and
1113 .B \-\-no\-warn
1114 have to be used to not display warnings and to not alter the exit status.
1115 .TP
1116 .B \-\-robot
1117 Print messages in a machine-parsable format. This is intended to ease
1118 writing frontends that want to use
1119 .B xz
1120 instead of liblzma, which may be the case with various scripts. The output
1121 with this option enabled is meant to be stable across
1122 .B xz
1123 releases. See the section
1124 .B "ROBOT MODE"
1125 for details.
1126 .TP
1127 .BR \-\-info-memory
1128 Display the current memory usage limit in human-readable format on
1129 a single line, and exit successfully. To see how much RAM
1130 .B xz
1131 thinks your system has, use
1132 .BR "\-\-memory=100% \-\-info\-memory" .
1133 .TP
1134 .BR \-h ", " \-\-help
1135 Display a help message describing the most commonly used options,
1136 and exit successfully.
1137 .TP
1138 .BR \-H ", " \-\-long\-help
1139 Display a help message describing all features of
1140 .BR xz ,
1141 and exit successfully
1142 .TP
1143 .BR \-V ", " \-\-version
1144 Display the version number of
1145 .B xz
1146 and liblzma in human readable format. To get machine-parsable output, specify
1147 .B \-\-robot
1148 before
1149 .BR \-\-version .
1150 .SH ROBOT MODE
1151 The robot mode is activated with the
1152 .B \-\-robot
1153 option. It makes the output of
1154 .B xz
1155 easier to parse by other programs. Currently
1156 .B \-\-robot
1157 is supported only together with
1158 .BR \-\-version ,
1159 .BR \-\-info-memory ,
1160 and
1161 .BR \-\-list .
1162 It will be supported for normal compression and decompression in the future.
1163 .PP
1164 .SS Version
1165 .B "xz \-\-robot \-\-version"
1166 will print the version number of
1167 .B xz
1168 and liblzma in the following format:
1169 .PP
1170 .BI XZ_VERSION= XYYYZZZS
1171 .br
1172 .BI LIBLZMA_VERSION= XYYYZZZS
1173 .TP
1174 .I X
1175 Major version.
1176 .TP
1177 .I YYY
1178 Minor version. Even numbers are stable.
1179 Odd numbers are alpha or beta versions.
1180 .TP
1181 .I ZZZ
1182 Patch level for stable releases or just a counter for development releases.
1183 .TP
1184 .I S
1185 Stability.
1186 .B 0
1187 is alpha,
1188 .B 1
1189 is beta, and
1190 .B 2
1191 is stable.
1192 .I S
1193 should be always
1194 .B 2
1195 when
1196 .I YYY
1197 is even.
1198 .PP
1199 .I XYYYZZZS
1200 are the same on both lines if
1201 .B xz
1202 and liblzma are from the same XZ Utils release.
1203 .PP
1204 Examples: 4.999.9beta is
1205 .B 49990091
1206 and
1207 5.0.0 is
1208 .BR 50000002 .
1209 .SS Memory limit information
1210 .B "xz \-\-robot \-\-info-memory"
1211 prints the current memory usage limit as bytes on a single line.
1212 To get the total amount of installed RAM, use
1213 .BR "xz \-\-robot \-\-memory=100% \-\-info-memory" .
1214 .SS List mode
1215 .B "xz \-\-robot \-\-list"
1216 uses tab-separated output. The first column of every line has a string
1217 that indicates the type of the information found on that line:
1218 .TP
1219 .B name
1220 This is always the first line when starting to list a file. The second
1221 column on the line is the filename.
1222 .TP
1223 .B file
1224 This line contains overall information about the
1225 .B .xz
1226 file. This line is always printed after the
1227 .B name
1228 line.
1229 .TP
1230 .B stream
1231 This line type is used only when
1232 .B \-\-verbose
1233 was specified. There are as many
1234 .B stream
1235 lines as there are streams in the
1236 .B .xz
1237 file.
1238 .TP
1239 .B block
1240 This line type is used only when
1241 .B \-\-verbose
1242 was specified. There are as many
1243 .B block
1244 lines as there are blocks in the
1245 .B .xz
1246 file. The
1247 .B block
1248 lines are shown after all the
1249 .B stream
1250 lines; different line types are not interleaved.
1251 .TP
1252 .B summary
1253 This line type is used only when
1254 .B \-\-verbose
1255 was specified twice. This line is printed after all
1256 .B block
1257 lines. Like the
1258 .B file
1259 line, the
1260 .B summary
1261 line contains overall information about the
1262 .B .xz
1263 file.
1264 .TP
1265 .B totals
1266 This line is always the very last line of the list output. It shows
1267 the total counts and sizes.
1268 .PP
1269 The columns of the
1270 .B file
1271 lines:
1272 .RS
1273 .IP 2. 4
1274 Number of streams in the file
1275 .IP 3. 4
1276 Total number of blocks in the stream(s)
1277 .IP 4. 4
1278 Compressed size of the file
1279 .IP 5. 4
1280 Uncompressed size of the file
1281 .IP 6. 4
1282 Compression ratio, for example
1283 .BR 0.123.
1284 If ratio is over 9.999, three dashes
1285 .RB ( \-\-\- )
1286 are displayed instead of the ratio.
1287 .IP 7. 4
1288 Comma-separated list of integrity check names. The following strings are
1289 used for the known check types:
1290 .BR None ,
1291 .BR CRC32 ,
1292 .BR CRC64 ,
1293 and
1294 .BR SHA\-256 .
1295 For unknown check types,
1296 .BI Unknown\- N
1297 is used, where
1298 .I N
1299 is the Check ID as a decimal number (one or two digits).
1300 .IP 8. 4
1301 Total size of stream padding in the file
1302 .RE
1303 .PP
1304 The columns of the
1305 .B stream
1306 lines:
1307 .RS
1308 .IP 2. 4
1309 Stream number (the first stream is 1)
1310 .IP 3. 4
1311 Number of blocks in the stream
1312 .IP 4. 4
1313 Compressed start offset
1314 .IP 5. 4
1315 Uncompressed start offset
1316 .IP 6. 4
1317 Compressed size (does not include stream padding)
1318 .IP 7. 4
1319 Uncompressed size
1320 .IP 8. 4
1321 Compression ratio
1322 .IP 9. 4
1323 Name of the integrity check
1324 .IP 10. 4
1325 Size of stream padding
1326 .RE
1327 .PP
1328 The columns of the
1329 .B block
1330 lines:
1331 .RS
1332 .IP 2. 4
1333 Number of the stream containing this block
1334 .IP 3. 4
1335 Block number relative to the beginning of the stream (the first block is 1)
1336 .IP 4. 4
1337 Block number relative to the beginning of the file
1338 .IP 5. 4
1339 Compressed start offset relative to the beginning of the file
1340 .IP 6. 4
1341 Uncompressed start offset relative to the beginning of the file
1342 .IP 7. 4
1343 Total compressed size of the block (includes headers)
1344 .IP 8. 4
1345 Uncompressed size
1346 .IP 9. 4
1347 Compression ratio
1348 .IP 10. 4
1349 Name of the integrity check
1350 .RE
1351 .PP
1352 If
1353 .B \-\-verbose
1354 was specified twice, additional columns are included on the
1355 .B block
1356 lines. These are not displayed with a single
1357 .BR \-\-verbose ,
1358 because getting this information requires many seeks and can thus be slow:
1359 .RS
1360 .IP 11. 4
1361 Value of the integrity check in hexadecimal
1362 .IP 12. 4
1363 Block header size
1364 .IP 13. 4
1365 Block flags:
1366 .B c
1367 indicates that compressed size is present, and
1368 .B u
1369 indicates that uncompressed size is present.
1370 If the flag is not set, a dash
1371 .RB ( \- )
1372 is shown instead to keep the string length fixed. New flags may be added
1373 to the end of the string in the future.
1374 .IP 14. 4
1375 Size of the actual compressed data in the block (this excludes
1376 the block header, block padding, and check fields)
1377 .IP 15. 4
1378 Amount of memory (as bytes) required to decompress this block with this
1379 .B xz
1380 version
1381 .IP 16. 4
1382 Filter chain. Note that most of the options used at compression time cannot
1383 be known, because only the options that are needed for decompression are
1384 stored in the
1385 .B .xz
1386 headers.
1387 .RE
1388 .PP
1389 The columns of the
1390 .B totals
1391 line:
1392 .RS
1393 .IP 2. 4
1394 Number of streams
1395 .IP 3. 4
1396 Number of blocks
1397 .IP 4. 4
1398 Compressed size
1399 .IP 5. 4
1400 Uncompressed size
1401 .IP 6. 4
1402 Average compression ratio
1403 .IP 7. 4
1404 Comma-separated list of integrity check names that were present in the files
1405 .IP 8. 4
1406 Stream padding size
1407 .IP 9. 4
1408 Number of files. This is here to keep the order of the earlier columns
1409 the same as on
1410 .B file
1411 lines.
1412 .RE
1413 .PP
1414 If
1415 .B \-\-verbose
1416 was specified twice, additional columns are included on the
1417 .B totals
1418 line:
1419 .RS
1420 .IP 10. 4
1421 Maximum amount of memory (as bytes) required to decompress the files
1422 with this
1423 .B xz
1424 version
1425 .IP 11. 4
1426 .B yes
1427 or
1428 .B no
1429 indicating if all block headers have both compressed size and
1430 uncompressed size stored in them
1431 .RE
1432 .PP
1433 Future versions may add new line types and new columns can be added to
1434 the existing line types, but the existing columns won't be changed.
1435 .SH "EXIT STATUS"
1436 .TP
1437 .B 0
1438 All is good.
1439 .TP
1440 .B 1
1441 An error occurred.
1442 .TP
1443 .B 2
1444 Something worth a warning occurred, but no actual errors occurred.
1445 .PP
1446 Notices (not warnings or errors) printed on standard error don't affect
1447 the exit status.
1448 .SH ENVIRONMENT
1449 .TP
1450 .B XZ_OPT
1451 A space-separated list of options is parsed from
1452 .B XZ_OPT
1453 before parsing the options given on the command line. Note that only
1454 options are parsed from
1455 .BR XZ_OPT ;
1456 all non-options are silently ignored. Parsing is done with
1457 .BR getopt_long (3)
1458 which is used also for the command line arguments.
1459 .SH "LZMA UTILS COMPATIBILITY"
1460 The command line syntax of
1461 .B xz
1462 is practically a superset of
1463 .BR lzma ,
1464 .BR unlzma ,
1465 and
1466 .BR lzcat
1467 as found from LZMA Utils 4.32.x. In most cases, it is possible to replace
1468 LZMA Utils with XZ Utils without breaking existing scripts. There are some
1469 incompatibilities though, which may sometimes cause problems.
1470 .SS "Compression preset levels"
1471 The numbering of the compression level presets is not identical in
1472 .B xz
1473 and LZMA Utils.
1474 The most important difference is how dictionary sizes are mapped to different
1475 presets. Dictionary size is roughly equal to the decompressor memory usage.
1476 .RS
1477 .TS
1478 tab(;);
1479 c c c
1480 c n n.
1481 Level;xz;LZMA Utils
1482 \-1;64 KiB;64 KiB
1483 \-2;512 KiB;1 MiB
1484 \-3;1 MiB;512 KiB
1485 \-4;2 MiB;1 MiB
1486 \-5;4 MiB;2 MiB
1487 \-6;8 MiB;4 MiB
1488 \-7;16 MiB;8 MiB
1489 \-8;32 MiB;16 MiB
1490 \-9;64 MiB;32 MiB
1491 .TE
1492 .RE
1493 .PP
1494 The dictionary size differences affect the compressor memory usage too,
1495 but there are some other differences between LZMA Utils and XZ Utils, which
1496 make the difference even bigger:
1497 .RS
1498 .TS
1499 tab(;);
1500 c c c
1501 c n n.
1502 Level;xz;LZMA Utils 4.32.x
1503 \-1;2 MiB;2 MiB
1504 \-2;5 MiB;12 MiB
1505 \-3;13 MiB;12 MiB
1506 \-4;25 MiB;16 MiB
1507 \-5;48 MiB;26 MiB
1508 \-6;94 MiB;45 MiB
1509 \-7;186 MiB;83 MiB
1510 \-8;370 MiB;159 MiB
1511 \-9;674 MiB;311 MiB
1512 .TE
1513 .RE
1514 .PP
1515 The default preset level in LZMA Utils is
1516 .B \-7
1517 while in XZ Utils it is
1518 .BR \-6 ,
1519 so both use 8 MiB dictionary by default.
1520 .SS "Streamed vs. non-streamed .lzma files"
1521 Uncompressed size of the file can be stored in the
1522 .B .lzma
1523 header. LZMA Utils does that when compressing regular files.
1524 The alternative is to mark that uncompressed size is unknown and
1525 use end of payload marker to indicate where the decompressor should stop.
1526 LZMA Utils uses this method when uncompressed size isn't known, which is
1527 the case for example in pipes.
1528 .PP
1529 .B xz
1530 supports decompressing
1531 .B .lzma
1532 files with or without end of payload marker, but all
1533 .B .lzma
1534 files created by
1535 .B xz
1536 will use end of payload marker and have uncompressed size marked as unknown
1537 in the
1538 .B .lzma
1539 header. This may be a problem in some (uncommon) situations. For example, a
1540 .B .lzma
1541 decompressor in an embedded device might work only with files that have known
1542 uncompressed size. If you hit this problem, you need to use LZMA Utils or
1543 LZMA SDK to create
1544 .B .lzma
1545 files with known uncompressed size.
1546 .SS "Unsupported .lzma files"
1547 The
1548 .B .lzma
1549 format allows
1550 .I lc
1551 values up to 8, and
1552 .I lp
1553 values up to 4. LZMA Utils can decompress files with any
1554 .I lc
1555 and
1556 .IR lp ,
1557 but always creates files with
1558 .B lc=3
1559 and
1560 .BR lp=0 .
1561 Creating files with other
1562 .I lc
1563 and
1564 .I lp
1565 is possible with
1566 .B xz
1567 and with LZMA SDK.
1568 .PP
1569 The implementation of the LZMA1 filter in liblzma requires
1570 that the sum of
1571 .I lc
1572 and
1573 .I lp
1574 must not exceed 4. Thus,
1575 .B .lzma
1576 files which exceed this limitation, cannot be decompressed with
1577 .BR xz .
1578 .PP
1579 LZMA Utils creates only
1580 .B .lzma
1581 files which have dictionary size of
1582 .RI "2^" n
1583 (a power of 2), but accepts files with any dictionary size.
1584 liblzma accepts only
1585 .B .lzma
1586 files which have dictionary size of
1587 .RI "2^" n
1588 or
1589 .RI "2^" n " + 2^(" n "\-1)."
1590 This is to decrease false positives when detecting
1591 .B .lzma
1592 files.
1593 .PP
1594 These limitations shouldn't be a problem in practice, since practically all
1595 .B .lzma
1596 files have been compressed with settings that liblzma will accept.
1597 .SS "Trailing garbage"
1598 When decompressing, LZMA Utils silently ignore everything after the first
1599 .B .lzma
1600 stream. In most situations, this is a bug. This also means that LZMA Utils
1601 don't support decompressing concatenated
1602 .B .lzma
1603 files.
1604 .PP
1605 If there is data left after the first
1606 .B .lzma
1607 stream,
1608 .B xz
1609 considers the file to be corrupt. This may break obscure scripts which have
1610 assumed that trailing garbage is ignored.
1611 .SH NOTES
1612 .SS Compressed output may vary
1613 The exact compressed output produced from the same uncompressed input file
1614 may vary between XZ Utils versions even if compression options are identical.
1615 This is because the encoder can be improved (faster or better compression)
1616 without affecting the file format. The output can vary even between different
1617 builds of the same XZ Utils version, if different build options are used.
1618 .PP
1619 The above means that implementing
1620 .B \-\-rsyncable
1621 to create rsyncable
1622 .B .xz
1623 files is not going to happen without freezing a part of the encoder
1624 implementation, which can then be used with
1625 .BR \-\-rsyncable .
1626 .SS Embedded .xz decompressors
1627 Embedded
1628 .B .xz
1629 decompressor implementations like XZ Embedded don't necessarily support files
1630 created with
1631 .I check
1632 types other than
1633 .B none
1634 and
1635 .BR crc32 .
1636 Since the default is \fB\-\-check=\fIcrc64\fR, you must use
1637 .B \-\-check=none
1638 or
1639 .B \-\-check=crc32
1640 when creating files for embedded systems.
1641 .PP
1642 Outside embedded systems, all
1643 .B .xz
1644 format decompressors support all the
1645 .I check
1646 types, or at least are able to decompress the file without verifying the
1647 integrity check if the particular
1648 .I check
1649 is not supported.
1650 .PP
1651 XZ Embedded supports BCJ filters, but only with the default start offset.
1652 .SH EXAMPLES
1653 .SS Basics
1654 A mix of compressed and uncompressed files can be decompressed
1655 to standard output with a single command:
1656 .IP
1657 .B "xz -dcf a.txt b.txt.xz c.txt d.txt.xz > abcd.txt"
1658 .SS Parallel compression of many files
1659 On GNU and *BSD,
1660 .BR find (1)
1661 and
1662 .BR xargs (1)
1663 can be used to parallellize compression of many files:
1664 .PP
1665 .IP
1666 .B "find . \-type f \e! \-name '*.xz' \-print0 | xargs \-0r \-P4 \-n16 xz"
1667 .PP
1668 The
1669 .B \-P
1670 option sets the number of parallel
1671 .B xz
1672 processes. The best value for the
1673 .B \-n
1674 option depends on how many files there are to be compressed.
1675 If there are only a couple of files, the value should probably be
1676 .BR 1 ;
1677 with tens of thousands of files,
1678 .B 100
1679 or even more may be appropriate to reduce the number of
1680 .B xz
1681 processes that
1682 .BR xargs (1)
1683 will eventually create.
1684 .SS Robot mode examples
1685 Calculating how many bytes have been saved in total after compressing
1686 multiple files:
1687 .IP
1688 .B "xz --robot --list *.xz | awk '/^totals/{print $5\-$4}'"
1689 .SH "SEE ALSO"
1690 .BR xzdec (1),
1691 .BR gzip (1),
1692 .BR bzip2 (1)
1693 .PP
1694 XZ Utils: <http://tukaani.org/xz/>
1695 .br
1696 XZ Embedded: <http://tukaani.org/xz/embedded.html>
1697 .br
1698 LZMA SDK: <http://7-zip.org/sdk.html>