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 of 400 MB/s per core, linearly scalable with multi-core CPUs. It
23       features an extremely fast decoder, with 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
39
40lz4 shows real-time notification statistics during  compression  or
41           decompression of a single file (use -q to silence them)
42
43       •   When  no  destination is specified, result is sent on implicit out‐
44           put, which depends on stdout status. When stdout is  Not  the  con‐
45           sole,  it  becomes the implicit output. Otherwise, if stdout is the
46           console, the implicit output is filename.lz4.
47
48       •   It is considered  bad  practice  to  rely  on  implicit  output  in
49           scripts.  because  the  script´s environment may change. Always use
50           explicit output in scripts. -c ensures that output will be  stdout.
51           Conversely,  providing a destination name, or using -m ensures that
52           the output will be either the specified name, or  filename.lz4  re‐
53           spectively.
54
55
56
57       Default behaviors can be modified by opt-in commands, detailed below.
58
59lz4 -m makes it possible to provide multiple input filenames, which
60           will be compressed into files using suffix .lz4. Progress notifica‐
61           tions become disabled by default (use -v to enable them). This mode
62           has a behavior which more closely mimics gzip  command  line,  with
63           the main remaining difference being that source files are preserved
64           by default.
65
66       •   Similarly, lz4 -m -d can decompress multiple *.lz4 files.
67
68       •   It´s possible to opt-in to erase source files  on  successful  com‐
69           pression or decompression, using --rm command.
70
71       •   Consequently, lz4 -m --rm behaves the same as gzip.
72
73
74
75   Concatenation of .lz4 files
76       It  is  possible  to  concatenate .lz4 files as is. lz4 will decompress
77       such files as if they were a single .lz4 file. For example:
78
79
80
81           lz4 file1  > foo.lz4
82           lz4 file2 >> foo.lz4
83
84
85
86       Then lz4cat foo.lz4 is equivalent to cat file1 file2.
87

OPTIONS

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

BUGS

229       Report bugs at: https://github.com/lz4/lz4/issues
230

AUTHOR

232       Yann Collet
233
234
235
236lz4 1.9.2                          July 2019                            LZ4(1)
Impressum