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 preserves original files
32
33       ·   lz4 compresses a single file by default (see -m for multiple files)
34
35       ·   lz4 file1 file2 means : compress file1 into file2
36
37       ·   lz4  file.lz4  will  default to decompression (use -z to force com‐
38           pression)
39
40       ·   lz4 shows real-time notification statistics during  compression  or
41           decompression of a single file (use -q to silence them)
42
43       ·   If no destination name is provided, result is sent to stdout except
44           if stdout is the console.
45
46       ·   If no destination name is provided, and if stdout is  the  console,
47           file is compressed into file.lz4.
48
49       ·   As  a  consequence  of previous rules, note the following example :
50           lz4 file | consumer sends compressed data to consumer through  std‐
51           out, hence it does not create file.lz4.
52
53       ·   Another  consequence of those rules is that to run lz4 under nohup,
54           you should provide a destination file:  nohup  lz4  file  file.lz4,
55           because nohup writes the specified command´s output to a file.
56
57
58
59       Default behaviors can be modified by opt-in commands, detailed below.
60
61       ·   lz4 -m makes it possible to provide multiple input filenames, which
62           will be compressed into files using suffix .lz4. Progress notifica‐
63           tions  are  also  disabled by default (use -v to enable them). This
64           mode has a behavior which more closely mimics  gzip  command  line,
65           with the main remaining difference being that source files are pre‐
66           served by default.
67
68       ·   Similarly, lz4 -m -d can decompress multiple *.lz4 files.
69
70       ·   It´s possible to opt-in to erase source files  on  successful  com‐
71           pression or decompression, using --rm command.
72
73       ·   Consequently, lz4 -m --rm behaves the same as gzip.
74
75
76
77   Concatenation of .lz4 files
78       It  is  possible  to  concatenate .lz4 files as is. lz4 will decompress
79       such files as if they were a single .lz4 file. For example:
80
81
82
83           lz4 file1  > foo.lz4
84           lz4 file2 >> foo.lz4
85
86
87
88       Then lz4cat foo.lz4 is equivalent to cat file1 file2.
89

OPTIONS

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

BUGS

216       Report bugs at: https://github.com/lz4/lz4/issues
217

AUTHOR

219       Yann Collet
220
221
222
223lz4 1.8.3                       September 2018                          LZ4(1)
Impressum