1 . 2 .TH "LZ4" "1" "November 2016" "lz4 1.7.4" "User Commands" 3 . 4 .SH "NAME" 5 \fBlz4\fR \- lz4, unlz4, lz4cat \- Compress or decompress \.lz4 files 6 . 7 .SH "SYNOPSIS" 8 \fBlz4\fR [\fIOPTIONS\fR] [\-|INPUT\-FILE] \fIOUTPUT\-FILE\fR 9 . 10 .P 11 \fBunlz4\fR is equivalent to \fBlz4 \-d\fR 12 . 13 .P 14 \fBlz4cat\fR is equivalent to \fBlz4 \-dcfm\fR 15 . 16 .P 17 When writing scripts that need to decompress files, it is recommended to always use the name \fBlz4\fR with appropriate arguments (\fBlz4 \-d\fR or \fBlz4 \-dc\fR) instead of the names \fBunlz4\fR and \fBlz4cat\fR\. 18 . 19 .SH "DESCRIPTION" 20 \fBlz4\fR is an extremely fast lossless compression algorithm, based on \fBbyte\-aligned LZ77\fR family of compression scheme\. \fBlz4\fR offers compression speeds of 400 MB/s per core, linearly scalable with multi\-core CPUs\. It features an extremely fast decoder, with speed in multiple GB/s per core, typically reaching RAM speed limit on multi\-core systems\. The native file format is the \fB\.lz4\fR format\. 21 . 22 .SS "Difference between lz4 and gzip" 23 \fBlz4\fR supports a command line syntax similar \fIbut not identical\fR to \fBgzip(1)\fR\. Differences are : 24 . 25 .IP "\(bu" 4 26 \fBlz4\fR preserves original files 27 . 28 .IP "\(bu" 4 29 \fBlz4\fR compresses a single file by default (see \fB\-m\fR for multiple files) 30 . 31 .IP "\(bu" 4 32 \fBlz4 file1 file2\fR means : compress file1 \fIinto\fR file2 33 . 34 .IP "\(bu" 4 35 \fBlz4\fR shows real\-time notification statistics during compression or decompression of a single file (use \fB\-q\fR to silent them) 36 . 37 .IP "\(bu" 4 38 If no destination name is provided, result is sent to \fBstdout\fR \fIexcept if stdout is the console\fR\. 39 . 40 .IP "\(bu" 4 41 If no destination name is provided, \fBand\fR if \fBstdout\fR is the console, \fBfile\fR is compressed into \fBfile\.lz4\fR\. 42 . 43 .IP "\(bu" 4 44 As a consequence of previous rules, note the following example : \fBlz4 file | consumer\fR sends compressed data to \fBconsumer\fR through \fBstdout\fR, hence it does \fInot\fR create any \fBfile\.lz4\fR\. 45 . 46 .IP "" 0 47 . 48 .P 49 Default behaviors can be modified by opt\-in commands, detailed below\. 50 . 51 .IP "\(bu" 4 52 \fBlz4 \-m\fR makes it possible to provide multiple input filenames, which will be compressed into files using suffix \fB\.lz4\fR\. Progress notifications are also disabled by default\. This mode has a behavior which more closely mimics \fBgzip\fR command line, with the main difference being that source files are preserved by default\. 53 . 54 .IP "\(bu" 4 55 It\'s possible to opt\-in to erase source files on successful compression or decompression, using \fB\-\-rm\fR command\. 56 . 57 .IP "\(bu" 4 58 Consequently, \fBlz4 \-m \-\-rm\fR behaves the same as \fBgzip\fR\. 59 . 60 .IP "" 0 61 . 62 .SS "Concatenation of \.lz4 files" 63 It is possible to concatenate \fB\.lz4\fR files as is\. \fBlz4\fR will decompress such files as if they were a single \fB\.lz4\fR file\. For example: lz4 file1 > foo\.lz4 lz4 file2 >> foo\.lz4 64 . 65 .P 66 then lz4cat foo\.lz4 67 . 68 .P 69 is equivalent to : cat file1 file2 70 . 71 .SH "OPTIONS" 72 . 73 .SS "Short commands concatenation" 74 In some cases, some options can be expressed using short command \fB\-x\fR or long command \fB\-\-long\-word\fR\. Short commands can be concatenated together\. For example, \fB\-d \-c\fR is equivalent to \fB\-dc\fR\. Long commands cannot be concatenated\. They must be clearly separated by a space\. 75 . 76 .SS "Multiple commands" 77 When multiple contradictory commands are issued on a same command line, only the latest one will be applied\. 78 . 79 .SS "Operation mode" 80 . 81 .TP 82 \fB\-z\fR \fB\-\-compress\fR 83 Compress\. This is the default operation mode when no operation mode option is specified, no other operation mode is implied from the command name (for example, \fBunlz4\fR implies \fB\-\-decompress\fR), nor from the input file name (for example, a file extension \fB\.lz4\fR implies \fB\-\-decompress\fR by default)\. \fB\-z\fR can also be used to force compression of an already compressed \fB\.lz4\fR file\. 84 . 85 .TP 86 \fB\-d\fR \fB\-\-decompress\fR \fB\-\-uncompress\fR 87 Decompress\. \fB\-\-decompress\fR is also the default operation when the input filename has an \fB\.lz4\fR extension\. 88 . 89 .TP 90 \fB\-t\fR \fB\-\-test\fR 91 Test the integrity of compressed \fB\.lz4\fR files\. The decompressed data is discarded\. No files are created nor removed\. 92 . 93 .TP 94 \fB\-b#\fR 95 Benchmark mode, using \fB#\fR compression level\. 96 . 97 .SS "Operation modifiers" 98 . 99 .TP 100 \fB\-#\fR 101 Compression level, with # being any value from 1 to 16\. Higher values trade compression speed for compression ratio\. Values above 16 are considered the same as 16\. Recommended values are 1 for fast compression (default), and 9 for high compression\. Speed/compression trade\-off will vary depending on data to compress\. Decompression speed remains fast at all settings\. 102 . 103 .TP 104 \fB\-f\fR \fB\-\-[no\-]force\fR 105 This option has several effects: 106 . 107 .IP 108 If the target file already exists, overwrite it without prompting\. 109 . 110 .IP 111 When used with \fB\-\-decompress\fR and \fBlz4\fR cannot recognize the type of the source file, copy the source file as is to standard output\. This allows \fBlz4cat \-\-force\fR to be used like \fBcat (1)\fR for files that have not been compressed with \fBlz4\fR\. 112 . 113 .TP 114 \fB\-c\fR \fB\-\-stdout\fR \fB\-\-to\-stdout\fR 115 Force write to standard output, even if it is the console\. 116 . 117 .TP 118 \fB\-m\fR \fB\-\-multiple\fR 119 Multiple input files\. Compressed file names will be appended a \fB\.lz4\fR suffix\. This mode also reduces notification level\. \fBlz4 \-m\fR has a behavior equivalent to \fBgzip \-k\fR (it preserves source files by default)\. 120 . 121 .TP 122 \fB\-r\fR 123 operate recursively on directories\. This mode also sets \fB\-m\fR (multiple input files)\. 124 . 125 .TP 126 \fB\-B#\fR 127 Block size [4\-7](default : 7) 128 . 129 .br 130 \fB\-B4\fR= 64KB ; \fB\-B5\fR= 256KB ; \fB\-B6\fR= 1MB ; \fB\-B7\fR= 4MB 131 . 132 .TP 133 \fB\-BD\fR 134 Block Dependency (improves compression ratio on small blocks) 135 . 136 .TP 137 \fB\-\-[no\-]frame\-crc\fR 138 Select frame checksum (default:enabled) 139 . 140 .TP 141 \fB\-\-[no\-]content\-size\fR 142 Header includes original size (default:not present) 143 . 144 .br 145 Note : this option can only be activated when the original size can be determined, hence for a file\. It won\'t work with unknown source size, such as stdin or pipe\. 146 . 147 .TP 148 \fB\-\-[no\-]sparse\fR 149 Sparse mode support (default:enabled on file, disabled on stdout) 150 . 151 .TP 152 \fB\-l\fR 153 Use Legacy format (typically for Linux Kernel compression) 154 . 155 .br 156 Note : \fB\-l\fR is not compatible with \fB\-m\fR (\fB\-\-multiple\fR) nor \fB\-r\fR 157 . 158 .SS "Other options" 159 . 160 .TP 161 \fB\-v\fR \fB\-\-verbose\fR 162 Verbose mode 163 . 164 .TP 165 \fB\-q\fR \fB\-\-quiet\fR 166 Suppress warnings and real\-time statistics; specify twice to suppress errors too 167 . 168 .TP 169 \fB\-h\fR \fB\-H\fR \fB\-\-help\fR 170 Display help/long help and exit 171 . 172 .TP 173 \fB\-V\fR \fB\-\-version\fR 174 Display Version number and exit 175 . 176 .TP 177 \fB\-k\fR \fB\-\-keep\fR 178 Preserve source files (default behavior) 179 . 180 .TP 181 \fB\-\-rm\fR 182 Delete source files on successful compression or decompression 183 . 184 .SS "Benchmark mode" 185 . 186 .TP 187 \fB\-b#\fR 188 Benchmark file(s), using # compression level 189 . 190 .TP 191 \fB\-e#\fR 192 Benchmark multiple compression levels, from b# to e# (included) 193 . 194 .TP 195 \fB\-i#\fR 196 Minimum evaluation in seconds [1\-9] (default : 3) 197 . 198 .TP 199 \fB\-r\fR 200 Operate recursively on directories 201 . 202 .SH "BUGS" 203 Report bugs at: https://github\.com/lz4/lz4/issues 204 . 205 .SH "AUTHOR" 206 Yann Collet 207