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 16. Higher
122              values trade compression speed  for  compression  ratio.  Values
123              above 16 are considered the same as 16. 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       -f --[no-]force
129              This option has several effects:
130
131              If the target file already exists, overwrite it without  prompt‐
132              ing.
133
134              When used with --decompress and lz4 cannot recognize the type of
135              the source file, copy the source file as is to standard  output.
136              This  allows  lz4cat  --force  to be used like cat (1) for files
137              that have not been compressed with lz4.
138
139       -c --stdout --to-stdout
140              Force write to standard output, even if it is the console.
141
142       -m --multiple
143              Multiple input files. Compressed file names will be  appended  a
144              .lz4  suffix.  This mode also reduces notification level. lz4 -m
145              has a behavior equivalent to gzip -k (it preserves source  files
146              by default).
147
148       -r     operate recursively on directories. This mode also sets -m (mul‐
149              tiple input files).
150
151       -B#    Block size [4-7](default : 7)
152              -B4= 64KB ; -B5= 256KB ; -B6= 1MB ; -B7= 4MB
153
154       -BD    Block Dependency (improves compression ratio on small blocks)
155
156       --[no-]frame-crc
157              Select frame checksum (default:enabled)
158
159       --[no-]content-size
160              Header includes original size (default:not present)
161              Note : this option can only be activated when the original  size
162              can  be determined, hence for a file. It won´t work with unknown
163              source size, such as stdin or pipe.
164
165       --[no-]sparse
166              Sparse mode support (default:enabled on file, disabled  on  std‐
167              out)
168
169       -l     Use Legacy format (typically for Linux Kernel compression)
170              Note : -l is not compatible with -m (--multiple) nor -r
171
172   Other options
173       -v --verbose
174              Verbose mode
175
176       -q --quiet
177              Suppress  warnings  and  real-time  statistics; specify twice to
178              suppress errors too
179
180       -h -H --help
181              Display help/long help and exit
182
183       -V --version
184              Display Version number and exit
185
186       -k --keep
187              Preserve source files (default behavior)
188
189       --rm   Delete source files on successful compression or decompression
190
191       --     Treat all subsequent arguments as files
192
193   Benchmark mode
194       -b#    Benchmark file(s), using # compression level
195
196       -e#    Benchmark multiple compression levels, from b# to e# (included)
197
198       -i#    Minimum evaluation in seconds [1-9] (default : 3)
199

BUGS

201       Report bugs at: https://github.com/lz4/lz4/issues
202

AUTHOR

204       Yann Collet
205
206
207
208lz4 1.8.1                         2018-01-13                            LZ4(1)
Impressum