1LZ4(1)                           User Commands                          LZ4(1)
2
3
4

NAME

6       lz4 - lz4, unlz4, lz4cat - Compress or decompress .lz4 files
7

SYNOPSIS

9       lz4 [OPTIONS] [-|INPUT-FILE] OUTPUT-FILE
10
11       unlz4 is equivalent to lz4 -d
12
13       lz4cat is equivalent to lz4 -dcfm
14
15       When  writing  scripts that need to decompress files, it is recommended
16       to always use the name lz4 with appropriate arguments (lz4  -d  or  lz4
17       -dc) instead of the names unlz4 and lz4cat.
18

DESCRIPTION

20       lz4  is  an  extremely  fast  lossless  compression algorithm, based on
21       byte-aligned LZ77 family of compression scheme. lz4 offers  compression
22       speeds  > 500 MB/s per core, linearly scalable with multi-core CPUs. It
23       features an extremely fast decoder, offering speed in multiple GB/s per
24       core, typically reaching RAM speed limit on multi-core systems. The na‐
25       tive file format is the .lz4 format.
26
27   Difference between lz4 and gzip
28       lz4 supports a  command  line  syntax  similar  but  not  identical  to
29       gzip(1). Differences are :
30
31lz4 compresses a single file by default (see -m for multiple files)
32
33lz4 file1 file2 means : compress file1 into file2
34
35lz4  file.lz4  will  default to decompression (use -z to force com‐
36           pression)
37
38lz4 preserves original files (see --rm to erase source file on com‐
39           pletion)
40
41lz4  shows  real-time notification statistics during compression or
42           decompression of a single file (use -q to silence them)
43
44       •   When no destination is specified, result is sent on  implicit  out‐
45           put,  which  depends  on stdout status. When stdout is Not the con‐
46           sole, it becomes the implicit output. Otherwise, if stdout  is  the
47           console, the implicit output is filename.lz4.
48
49       •   It  is  considered  bad  practice  to  rely  on  implicit output in
50           scripts. because the script´s environment may  change.  Always  use
51           explicit  output in scripts. -c ensures that output will be stdout.
52           Conversely, providing a destination name, or using -m ensures  that
53           the  output  will be either the specified name, or filename.lz4 re‐
54           spectively.
55
56
57
58       Default behaviors can be modified by opt-in commands, detailed below.
59
60lz4 -m makes it possible to provide multiple input filenames, which
61           will be compressed into files using suffix .lz4. Progress notifica‐
62           tions become disabled by default (use -v to enable them). This mode
63           has  a  behavior  which more closely mimics gzip command line, with
64           the main remaining difference being that source files are preserved
65           by default.
66
67       •   Similarly, lz4 -m -d can decompress multiple *.lz4 files.
68
69       •   It´s  possible  to  opt-in to erase source files on successful com‐
70           pression or decompression, using --rm command.
71
72       •   Consequently, lz4 -m --rm behaves the same as gzip.
73
74
75
76   Concatenation of .lz4 files
77       It is possible to concatenate .lz4 files as  is.  lz4  will  decompress
78       such files as if they were a single .lz4 file. For example:
79
80
81
82           lz4 file1  > foo.lz4
83           lz4 file2 >> foo.lz4
84
85
86
87       Then lz4cat foo.lz4 is equivalent to cat file1 file2.
88

OPTIONS

90   Short commands concatenation
91       In  some cases, some options can be expressed using short command -x or
92       long command --long-word. Short commands can be concatenated  together.
93       For  example,  -d -c is equivalent to -dc. Long commands cannot be con‐
94       catenated. They must be clearly separated by a space.
95
96   Multiple commands
97       When multiple contradictory commands are issued on a same command line,
98       only the latest one will be applied.
99
100   Operation mode
101       -z --compress
102              Compress.  This  is the default operation mode when no operation
103              mode option is specified, no other  operation  mode  is  implied
104              from the command name (for example, unlz4 implies --decompress),
105              nor from the input file name (for example, a file extension .lz4
106              implies  --decompress  by default). -z can also be used to force
107              compression of an already compressed .lz4 file.
108
109       -d --decompress --uncompress
110              Decompress. --decompress is also the default operation when  the
111              input filename has an .lz4 extension.
112
113       -t --test
114              Test  the  integrity  of compressed .lz4 files. The decompressed
115              data is discarded. No files are created nor removed.
116
117       -b#    Benchmark mode, using # compression level.
118
119       --list List information about .lz4 files. note : current implementation
120              is limited to single-frame .lz4 files.
121
122   Operation modifiers
123       -#     Compression  level,  with # being any value from 1 to 12. Higher
124              values trade compression speed  for  compression  ratio.  Values
125              above 12 are considered the same as 12. Recommended values are 1
126              for fast compression (default),  and  9  for  high  compression.
127              Speed/compression  trade-off will vary depending on data to com‐
128              press. Decompression speed remains fast at all settings.
129
130       --fast[=#]
131              Switch to ultra-fast compression levels. The higher  the  value,
132              the  faster  the compression speed, at the cost of some compres‐
133              sion ratio. If =# is not present, it defaults to 1. This setting
134              overrides  compression  level  if  one was set previously. Simi‐
135              larly, if a compression level is set after --fast, it  overrides
136              it.
137
138       --best Set highest compression level. Same as -12.
139
140       --favor-decSpeed
141              Generate compressed data optimized for decompression speed. Com‐
142              pressed data will be  larger  as  a  consequence  (typically  by
143              ~0.5%), while decompression speed will be improved by 5-20%, de‐
144              pending on use cases. This option only works in combination with
145              very high compression levels (>=10).
146
147       -D dictionaryName
148              Compress,  decompress  or benchmark using dictionary dictionary‐
149              Name. Compression and decompression must use the same dictionary
150              to be compatible. Using a different dictionary during decompres‐
151              sion will either abort due to decompression error, or generate a
152              checksum error.
153
154       -f --[no-]force
155              This option has several effects:
156
157              If  the target file already exists, overwrite it without prompt‐
158              ing.
159
160              When used with --decompress and lz4 cannot recognize the type of
161              the  source file, copy the source file as is to standard output.
162              This allows lz4cat --force to be used like  cat  (1)  for  files
163              that have not been compressed with lz4.
164
165       -c --stdout --to-stdout
166              Force write to standard output, even if it is the console.
167
168       -m --multiple
169              Multiple  input  files. Compressed file names will be appended a
170              .lz4 suffix. This mode also reduces notification level. Can also
171              be used to list multiple files. lz4 -m has a behavior equivalent
172              to gzip -k (it preserves source files by default).
173
174       -r     operate recursively on directories. This mode also sets -m (mul‐
175              tiple input files).
176
177       -B#    Block size [4-7](default : 7)
178              -B4= 64KB ; -B5= 256KB ; -B6= 1MB ; -B7= 4MB
179
180       -BI    Produce independent blocks (default)
181
182       -BD    Blocks  depend on predecessors (improves compression ratio, more
183              noticeable on small blocks)
184
185       -BX    Generate block checksums (default:disabled)
186
187       --[no-]frame-crc
188              Select frame checksum (default:enabled)
189
190       --no-crc
191              Disable both frame and block checksums
192
193       --[no-]content-size
194              Header includes original size (default:not present)
195              Note : this option can only be activated when the original  size
196              can  be determined, hence for a file. It won´t work with unknown
197              source size, such as stdin or pipe.
198
199       --[no-]sparse
200              Sparse mode support (default:enabled on file, disabled  on  std‐
201              out)
202
203       -l     Use Legacy format (typically for Linux Kernel compression)
204              Note : -l is not compatible with -m (--multiple) nor -r
205
206   Other options
207       -v --verbose
208              Verbose mode
209
210       -q --quiet
211              Suppress  warnings  and  real-time  statistics; specify twice to
212              suppress errors too
213
214       -h -H --help
215              Display help/long help and exit
216
217       -V --version
218              Display Version number and exit
219
220       -k --keep
221              Preserve source files (default behavior)
222
223       --rm   Delete source files on successful compression or decompression
224
225       --     Treat all subsequent arguments as files
226
227   Benchmark mode
228       -b#    Benchmark file(s), using # compression level
229
230       -e#    Benchmark multiple compression levels, from b# to e# (included)
231
232       -i#    Minimum evaluation time in seconds [1-9] (default : 3)
233

BUGS

235       Report bugs at: https://github.com/lz4/lz4/issues
236

AUTHOR

238       Yann Collet
239
240
241
242lz4 v1.9.4                        August 2022                           LZ4(1)
Impressum