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
25       native 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
31       ·   lz4 compresses a single file by default (see -m for multiple files)
32
33       ·   lz4 file1 file2 means : compress file1 into file2
34
35       ·   lz4  file.lz4  will  default to decompression (use -z to force com‐
36           pression)
37
38       ·   lz4 preserves original files
39
40       ·   lz4 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
53           respectively.
54
55
56
57       Default behaviors can be modified by opt-in commands, detailed below.
58
59       ·   lz4 -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       --favor-decSpeed
138              Generate compressed data optimized for decompression speed. Com‐
139              pressed  data  will  be  larger  as  a consequence (typically by
140              ~0.5%), while decompression speed will  be  improved  by  5-20%,
141              depending  on  use  cases. This option only works in combination
142              with very high compression levels (>=10).
143
144       -D dictionaryName
145              Compress, decompress or benchmark using  dictionary  dictionary‐
146              Name. Compression and decompression must use the same dictionary
147              to be compatible. Using a different dictionary during decompres‐
148              sion will either abort due to decompression error, or generate a
149              checksum error.
150
151       -f --[no-]force
152              This option has several effects:
153
154              If the target file already exists, overwrite it without  prompt‐
155              ing.
156
157              When used with --decompress and lz4 cannot recognize the type of
158              the source file, copy the source file as is to standard  output.
159              This  allows  lz4cat  --force  to be used like cat (1) for files
160              that have not been compressed with lz4.
161
162       -c --stdout --to-stdout
163              Force write to standard output, even if it is the console.
164
165       -m --multiple
166              Multiple input files. Compressed file names will be  appended  a
167              .lz4 suffix. This mode also reduces notification level. Can also
168              be used to list multiple files. lz4 -m has a behavior equivalent
169              to gzip -k (it preserves source files by default).
170
171       -r     operate recursively on directories. This mode also sets -m (mul‐
172              tiple input files).
173
174       -B#    Block size [4-7](default : 7)
175              -B4= 64KB ; -B5= 256KB ; -B6= 1MB ; -B7= 4MB
176
177       -BI    Produce independent blocks (default)
178
179       -BD    Blocks depend on predecessors (improves compression ratio,  more
180              noticeable on small blocks)
181
182       --[no-]frame-crc
183              Select frame checksum (default:enabled)
184
185       --[no-]content-size
186              Header includes original size (default:not present)
187              Note  : this option can only be activated when the original size
188              can be determined, hence for a file. It won´t work with  unknown
189              source size, such as stdin or pipe.
190
191       --[no-]sparse
192              Sparse  mode  support (default:enabled on file, disabled on std‐
193              out)
194
195       -l     Use Legacy format (typically for Linux Kernel compression)
196              Note : -l is not compatible with -m (--multiple) nor -r
197
198   Other options
199       -v --verbose
200              Verbose mode
201
202       -q --quiet
203              Suppress warnings and real-time  statistics;  specify  twice  to
204              suppress errors too
205
206       -h -H --help
207              Display help/long help and exit
208
209       -V --version
210              Display Version number and exit
211
212       -k --keep
213              Preserve source files (default behavior)
214
215       --rm   Delete source files on successful compression or decompression
216
217       --     Treat all subsequent arguments as files
218
219   Benchmark mode
220       -b#    Benchmark file(s), using # compression level
221
222       -e#    Benchmark multiple compression levels, from b# to e# (included)
223
224       -i#    Minimum evaluation time in seconds [1-9] (default : 3)
225

BUGS

227       Report bugs at: https://github.com/lz4/lz4/issues
228

AUTHOR

230       Yann Collet
231
232
233
234lz4 1.9.1                         April 2019                            LZ4(1)
Impressum