Debian Codegraph @

upstream/debian-unstable/man1/lz4.1

raw
1 .
2 .TH "LZ4" "1" "July 2024" "lz4 1.10.0" "User Commands"
3 .
4 .SH "NAME"
5 \fBlz4\fR \- lz4, unlz4, lz4cat \- Compress or decompress \.lz4 files
6 .
7 .SH "SYNOPSIS"
8 \fBlz4\fR [\fIOPTIONS\fR] [\-|INPUT\-FILE] \fIOUTPUT\-FILE\fR
9 .
10 .P
11 \fBunlz4\fR is equivalent to \fBlz4 \-d\fR
12 .
13 .P
14 \fBlz4cat\fR is equivalent to \fBlz4 \-dcfm\fR
15 .
16 .P
17 When writing scripts that need to decompress files, it is recommended to always use the name \fBlz4\fR with appropriate arguments (\fBlz4 \-d\fR or \fBlz4 \-dc\fR) instead of the names \fBunlz4\fR and \fBlz4cat\fR\.
18 .
19 .SH "DESCRIPTION"
20 \fBlz4\fR is a CLI based on \fBliblz4\fR, an extremely fast implementation of lossless compression algorithm\. It provides a default compression speed of typically > 500 MB/s per core\. Speed can traded for higher compression ratio, by increasing the compression level parameter\. While decompression is single\-threaded, it reaches multiple GB/s, generally fast enough to be I/O bound\. \fBlz4\fR native file format is the \fB\.lz4\fR format\.
21 .
22 .SS "Difference between lz4 and gzip"
23 \fBlz4\fR supports a command line syntax similar \fIbut not identical\fR to \fBgzip(1)\fR\. Differences are :
24 .
25 .IP "\(bu" 4
26 \fBlz4\fR compresses a single file by default (see \fB\-m\fR for multiple files)
27 .
28 .IP "\(bu" 4
29 \fBlz4 file1 file2\fR means : compress file1 \fIinto\fR file2
30 .
31 .IP "\(bu" 4
32 \fBlz4 file\.lz4\fR will default to decompression (use \fB\-z\fR to force compression)
33 .
34 .IP "\(bu" 4
35 \fBlz4\fR preserves original files (see \fB\-\-rm\fR to erase source file on completion)
36 .
37 .IP "\(bu" 4
38 \fBlz4\fR shows real\-time notification statistics during compression or decompression of a single file (use \fB\-q\fR to silence them)
39 .
40 .IP "\(bu" 4
41 When no destination is specified, result is sent on implicit output, which depends on \fBstdout\fR status\. When \fBstdout\fR \fIis Not the console\fR, it becomes the implicit output\. Otherwise, if \fBstdout\fR is the console, the implicit output is \fBfilename\.lz4\fR\.
42 .
43 .IP "\(bu" 4
44 It is considered bad practice to rely on implicit output in scripts\. because the script\'s environment may change\. Always use explicit output in scripts\. \fB\-c\fR ensures that output will be \fBstdout\fR\. Conversely, providing a destination name, or using \fB\-m\fR ensures that the output will be either the specified name, or \fBfilename\.lz4\fR respectively\.
45 .
46 .IP "" 0
47 .
48 .P
49 Default behaviors can be modified by opt\-in commands, detailed below\.
50 .
51 .IP "\(bu" 4
52 \fBlz4 \-m\fR makes it possible to provide multiple input filenames, which will be compressed into files using suffix \fB\.lz4\fR\. Progress notifications become disabled by default (use \fB\-v\fR to enable them)\. This mode has a behavior which more closely mimics \fBgzip\fR command line, with the main remaining difference being that source files are preserved by default\.
53 .
54 .IP "\(bu" 4
55 Similarly, \fBlz4 \-m \-d\fR can decompress multiple \fB*\.lz4\fR files\.
56 .
57 .IP "\(bu" 4
58 It\'s possible to opt\-in to erase source files on successful compression or decompression, using \fB\-\-rm\fR command\.
59 .
60 .IP "\(bu" 4
61 Consequently, \fBlz4 \-m \-\-rm\fR features a behavior closer to the \fBgzip\fR one\.
62 .
63 .IP "" 0
64 .
65 .SS "Concatenation of \.lz4 files"
66 It is possible to concatenate \fB\.lz4\fR files as is\. \fBlz4\fR will decompress such files as if they were a single \fB\.lz4\fR file\. For example:
67 .
68 .IP "" 4
69 .
70 .nf
71
72 lz4 file1 > foo\.lz4
73 lz4 file2 >> foo\.lz4
74 .
75 .fi
76 .
77 .IP "" 0
78 .
79 .P
80 Then \fBlz4cat foo\.lz4\fR is equivalent to \fBcat file1 file2\fR\.
81 .
82 .SH "OPTIONS"
83 .
84 .SS "Short commands concatenation"
85 In some cases, some options can be expressed using short command \fB\-x\fR or long command \fB\-\-long\-word\fR\. Short commands can be concatenated together\. For example, \fB\-d \-c\fR is equivalent to \fB\-dc\fR\. Long commands cannot be concatenated\. They must be clearly separated by a space\.
86 .
87 .SS "Multiple commands"
88 When multiple contradictory commands are issued on a same command line, only the latest one will be applied\.
89 .
90 .SS "Operation mode"
91 .
92 .TP
93 \fB\-z\fR \fB\-\-compress\fR
94 Compress\. This is the default operation mode when no operation mode option is specified, no other operation mode is implied from the command name (for example, \fBunlz4\fR implies \fB\-\-decompress\fR), nor from the input file name (for example, a file extension \fB\.lz4\fR implies \fB\-\-decompress\fR by default)\. \fB\-z\fR can also be used to force compression of an already compressed \fB\.lz4\fR file\.
95 .
96 .TP
97 \fB\-d\fR \fB\-\-decompress\fR \fB\-\-uncompress\fR
98 Decompress\. \fB\-\-decompress\fR is also the default operation when the input filename has an \fB\.lz4\fR extension\.
99 .
100 .TP
101 \fB\-t\fR \fB\-\-test\fR
102 Test the integrity of compressed \fB\.lz4\fR files\. The decompressed data is discarded\. No files are created nor removed\.
103 .
104 .TP
105 \fB\-b#\fR
106 Benchmark mode, using \fB#\fR compression level\.
107 .
108 .TP
109 \fB\-\-list\fR
110 List information about \.lz4 files\. For detailed information on files with multiple frames, use \fB\-v\fR\. \fB\-\-list\fR automatically triggers \fB\-m\fR modifier\.
111 .
112 .SS "Operation modifiers"
113 .
114 .TP
115 \fB\-#\fR
116 Compression level, with # being any value from 1 to 12\. Higher values trade compression speed for compression ratio\. Values above 12 are considered the same as 12\. Recommended values are 1 for fast compression (default), and 9 for high compression\. Speed/compression trade\-off will vary depending on data to compress\. Decompression speed remains fast at all settings\.
117 .
118 .TP
119 \fB\-\-fast[=#]\fR
120 Switch to ultra\-fast compression levels\. The higher the value, the faster the compression speed, at the cost of some compression ratio\. If \fB=#\fR is not present, it defaults to \fB1\fR\. This setting overrides compression level if one was set previously\. Similarly, if a compression level is set after \fB\-\-fast\fR, it overrides it\.
121 .
122 .TP
123 \fB\-\-best\fR
124 Set highest compression level\. Same as \-12\.
125 .
126 .TP
127 \fB\-T#\fR, \fB\-\-threads=#\fR
128 Use \fB#\fR threads for compression\. When \fB0\fR, or none provided: automatically determined from nb of detected cores\.
129 .
130 .TP
131 \fB\-\-favor\-decSpeed\fR
132 Generate compressed data optimized for decompression speed\. Compressed data will be larger as a consequence (typically by ~0\.5%), while decompression speed will be improved by 5\-20%, depending on use cases\. This option only works in combination with very high compression levels (>=10)\.
133 .
134 .TP
135 \fB\-D dictionaryName\fR
136 Compress, decompress or benchmark using dictionary \fIdictionaryName\fR\. Compression and decompression must use the same dictionary to be compatible\. Using a different dictionary during decompression will either abort due to decompression error, or generate a checksum error\.
137 .
138 .TP
139 \fB\-f\fR \fB\-\-[no\-]force\fR
140 This option has several effects:
141 .
142 .IP
143 If the target file already exists, overwrite it without prompting\.
144 .
145 .IP
146 When used with \fB\-\-decompress\fR and \fBlz4\fR cannot recognize the type of the source file, copy the source file as is to standard output\. This allows \fBlz4cat \-\-force\fR to be used like \fBcat (1)\fR for files that have not been compressed with \fBlz4\fR\.
147 .
148 .TP
149 \fB\-c\fR \fB\-\-stdout\fR \fB\-\-to\-stdout\fR
150 Force write to standard output, even if it is the console\.
151 .
152 .TP
153 \fB\-m\fR \fB\-\-multiple\fR
154 Multiple input files\. Compressed file names will be appended a \fB\.lz4\fR suffix\. This mode also reduces notification level\. Can also be used to list multiple files\. \fBlz4 \-m\fR has a behavior equivalent to \fBgzip \-k\fR (it preserves source files by default)\.
155 .
156 .TP
157 \fB\-r\fR
158 operate recursively on directories\. This mode also sets \fB\-m\fR (multiple input files)\.
159 .
160 .TP
161 \fB\-B#\fR
162 Block size [4\-7](default : 7)
163 .
164 .br
165 \fB\-B4\fR= 64KB ; \fB\-B5\fR= 256KB ; \fB\-B6\fR= 1MB ; \fB\-B7\fR= 4MB
166 .
167 .TP
168 \fB\-BI\fR
169 Produce independent blocks (default)
170 .
171 .TP
172 \fB\-BD\fR
173 Blocks depend on predecessors (improves compression ratio, more noticeable on small blocks)
174 .
175 .TP
176 \fB\-BX\fR
177 Generate block checksums (default:disabled)
178 .
179 .TP
180 \fB\-\-[no\-]frame\-crc\fR
181 Select frame checksum (default:enabled)
182 .
183 .TP
184 \fB\-\-no\-crc\fR
185 Disable both frame and block checksums
186 .
187 .TP
188 \fB\-\-[no\-]content\-size\fR
189 Header includes original size (default:not present)
190 .
191 .br
192 Note : this option can only be activated when the original size can be determined, hence for a file\. It won\'t work with unknown source size, such as stdin or pipe\.
193 .
194 .TP
195 \fB\-\-[no\-]sparse\fR
196 Sparse mode support (default:enabled on file, disabled on stdout)
197 .
198 .TP
199 \fB\-l\fR
200 Use Legacy format (typically for Linux Kernel compression)
201 .
202 .br
203 Note : \fB\-l\fR is not compatible with \fB\-m\fR (\fB\-\-multiple\fR) nor \fB\-r\fR
204 .
205 .SS "Other options"
206 .
207 .TP
208 \fB\-v\fR \fB\-\-verbose\fR
209 Verbose mode
210 .
211 .TP
212 \fB\-q\fR \fB\-\-quiet\fR
213 Suppress warnings and real\-time statistics; specify twice to suppress errors too
214 .
215 .TP
216 \fB\-h\fR \fB\-H\fR \fB\-\-help\fR
217 Display help/long help and exit
218 .
219 .TP
220 \fB\-V\fR \fB\-\-version\fR
221 Display Version number and exit
222 .
223 .TP
224 \fB\-k\fR \fB\-\-keep\fR
225 Preserve source files (default behavior)
226 .
227 .TP
228 \fB\-\-rm\fR
229 Delete source files on successful compression or decompression
230 .
231 .TP
232 \fB\-\-\fR
233 Treat all subsequent arguments as files
234 .
235 .SS "Benchmark mode"
236 .
237 .TP
238 \fB\-b#\fR
239 Benchmark file(s), using # compression level
240 .
241 .TP
242 \fB\-e#\fR
243 Benchmark multiple compression levels, from b# to e# (included)
244 .
245 .TP
246 \fB\-i#\fR
247 Minimum evaluation time in seconds [1\-9] (default : 3)
248 .
249 .SS "Environment Variables"
250 It\'s possible to pass some parameters to \fBlz4\fR via environment variables\. This can be useful in situations where \fBlz4\fR is known to be invoked (from a script for example) but there is no way to pass \fBlz4\fR parameters to influence the compression session\. The environment variable has higher priority than executable default, but lower priority than corresponding runtime command\. When set as global environment variables, it can be a way to enforce personalized defaults different from the executable set ones\.
251 .
252 .TP
253 \fBLZ4_CLEVEL\fR
254 specify a default compression level that \fBlz4\fR employs for compression when no other compression level is specified on command line\. Executable default is generally \fB1\fR\.
255 .
256 .TP
257 \fBLZ4_NBWORKERS\fR
258 specify a default number of threads that \fBlz4\fR will employ for compression\. Executable default is generally \fB0\fR, which means auto\-determined based on local cpu\. This functionality is only relevant when \fBlz4\fR is compiled with multithreading support\. The maximum number of workers is capped at \fBLZ4_NBWORKERS_MAX\fR (\fB200\fR by default)\.
259 .
260 .SH "BUGS"
261 Report bugs at: https://github\.com/lz4/lz4/issues
262 .
263 .SH "AUTHOR"
264 Yann Collet