lz4/programs/lz4.1

242 lines
8.9 KiB
Groff
Raw Normal View History

2016-11-28 07:23:40 +00:00
.
.TH "LZ4" "1" "July 2019" "lz4 1.9.2" "User Commands"
2016-11-28 07:23:40 +00:00
.
.SH "NAME"
\fBlz4\fR \- lz4, unlz4, lz4cat \- Compress or decompress \.lz4 files
.
.SH "SYNOPSIS"
\fBlz4\fR [\fIOPTIONS\fR] [\-|INPUT\-FILE] \fIOUTPUT\-FILE\fR
.
.P
\fBunlz4\fR is equivalent to \fBlz4 \-d\fR
.
.P
\fBlz4cat\fR is equivalent to \fBlz4 \-dcfm\fR
.
.P
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\.
.
.SH "DESCRIPTION"
\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\.
.
.SS "Difference between lz4 and gzip"
\fBlz4\fR supports a command line syntax similar \fIbut not identical\fR to \fBgzip(1)\fR\. Differences are :
.
.IP "\(bu" 4
2016-11-28 11:43:01 +00:00
\fBlz4\fR compresses a single file by default (see \fB\-m\fR for multiple files)
2016-11-28 07:23:40 +00:00
.
.IP "\(bu" 4
\fBlz4 file1 file2\fR means : compress file1 \fIinto\fR file2
.
.IP "\(bu" 4
2017-08-07 04:04:46 +00:00
\fBlz4 file\.lz4\fR will default to decompression (use \fB\-z\fR to force compression)
.
.IP "\(bu" 4
\fBlz4\fR preserves original files
2016-11-28 07:23:40 +00:00
.
.IP "\(bu" 4
\fBlz4\fR shows real\-time notification statistics during compression or decompression of a single file (use \fB\-q\fR to silence them)
2016-11-28 11:43:01 +00:00
.
.IP "\(bu" 4
When no destination is specified, result is sent on implicit output, which depends on \fBstdout\fR status\. When \fBstdout\fR \fIis Not the console\fR, it becomes the implicit output\. Otherwise, if \fBstdout\fR is the console, the implicit output is \fBfilename\.lz4\fR\.
2016-11-28 07:23:40 +00:00
.
2018-01-14 03:06:33 +00:00
.IP "\(bu" 4
It is considered bad practice to rely on implicit output in scripts\. because the script\'s environment may change\. Always use explicit output in scripts\. \fB\-c\fR ensures that output will be \fBstdout\fR\. Conversely, providing a destination name, or using \fB\-m\fR ensures that the output will be either the specified name, or \fBfilename\.lz4\fR respectively\.
2018-01-14 03:06:33 +00:00
.
2016-11-28 07:23:40 +00:00
.IP "" 0
.
.P
2016-11-28 11:43:01 +00:00
Default behaviors can be modified by opt\-in commands, detailed below\.
.
.IP "\(bu" 4
\fBlz4 \-m\fR makes it possible to provide multiple input filenames, which will be compressed into files using suffix \fB\.lz4\fR\. Progress notifications become disabled by default (use \fB\-v\fR to enable them)\. This mode has a behavior which more closely mimics \fBgzip\fR command line, with the main remaining difference being that source files are preserved by default\.
2017-08-07 04:04:46 +00:00
.
.IP "\(bu" 4
Similarly, \fBlz4 \-m \-d\fR can decompress multiple \fB*\.lz4\fR files\.
2016-11-28 11:43:01 +00:00
.
.IP "\(bu" 4
It\'s possible to opt\-in to erase source files on successful compression or decompression, using \fB\-\-rm\fR command\.
.
.IP "\(bu" 4
Consequently, \fBlz4 \-m \-\-rm\fR behaves the same as \fBgzip\fR\.
.
.IP "" 0
2016-11-28 07:23:40 +00:00
.
.SS "Concatenation of \.lz4 files"
2017-08-07 04:04:46 +00:00
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:
2016-11-28 07:23:40 +00:00
.
2017-08-07 04:04:46 +00:00
.IP "" 4
.
.nf
lz4 file1 > foo\.lz4
lz4 file2 >> foo\.lz4
.
.fi
.
.IP "" 0
2016-11-28 07:23:40 +00:00
.
.P
2017-08-07 04:04:46 +00:00
Then \fBlz4cat foo\.lz4\fR is equivalent to \fBcat file1 file2\fR\.
2016-11-28 07:23:40 +00:00
.
.SH "OPTIONS"
2015-03-22 12:42:00 +00:00
.
.SS "Short commands concatenation"
2016-11-28 07:23:40 +00:00
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\.
.
.SS "Multiple commands"
2016-11-28 07:23:40 +00:00
When multiple contradictory commands are issued on a same command line, only the latest one will be applied\.
2015-03-22 12:42:00 +00:00
.
.SS "Operation mode"
2016-11-28 07:23:40 +00:00
.
.TP
\fB\-z\fR \fB\-\-compress\fR
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\.
.
2015-03-22 12:42:00 +00:00
.TP
2016-11-28 07:23:40 +00:00
\fB\-d\fR \fB\-\-decompress\fR \fB\-\-uncompress\fR
Decompress\. \fB\-\-decompress\fR is also the default operation when the input filename has an \fB\.lz4\fR extension\.
.
.TP
\fB\-t\fR \fB\-\-test\fR
Test the integrity of compressed \fB\.lz4\fR files\. The decompressed data is discarded\. No files are created nor removed\.
.
.TP
\fB\-b#\fR
Benchmark mode, using \fB#\fR compression level\.
2015-03-22 12:42:00 +00:00
.
.TP
\fB\-\-list\fR
2019-04-22 22:14:53 +00:00
List information about \.lz4 files\. note : current implementation is limited to single\-frame \.lz4 files\.
.
2015-03-22 12:42:00 +00:00
.SS "Operation modifiers"
2016-11-28 07:23:40 +00:00
.
.TP
\fB\-#\fR
Compression level, with # being any value from 1 to 12\. Higher values trade compression speed for compression ratio\. Values above 12 are considered the same as 12\. 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\.
.
.TP
2019-04-12 20:15:05 +00:00
\fB\-\-fast[=#]\fR
Switch to ultra\-fast compression levels\. The higher the value, the faster the compression speed, at the cost of some compression ratio\. If \fB=#\fR is not present, it defaults to \fB1\fR\. This setting overrides compression level if one was set previously\. Similarly, if a compression level is set after \fB\-\-fast\fR, it overrides it\.
.
.TP
\fB\-\-best\fR
Set highest compression level\. Same as -12\.
.
.TP
2019-04-12 20:15:05 +00:00
\fB\-\-favor\-decSpeed\fR
Generate compressed data optimized for decompression speed\. Compressed data will be larger as a consequence (typically by ~0\.5%), while decompression speed will be improved by 5\-20%, depending on use cases\. This option only works in combination with very high compression levels (>=10)\.
.
.TP
\fB\-D dictionaryName\fR
Compress, decompress or benchmark using dictionary \fIdictionaryName\fR\. Compression and decompression must use the same dictionary to be compatible\. Using a different dictionary during decompression will either abort due to decompression error, or generate a checksum error\.
2016-11-28 07:23:40 +00:00
.
.TP
\fB\-f\fR \fB\-\-[no\-]force\fR
This option has several effects:
.
.IP
If the target file already exists, overwrite it without prompting\.
.
.IP
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\.
.
.TP
\fB\-c\fR \fB\-\-stdout\fR \fB\-\-to\-stdout\fR
Force write to standard output, even if it is the console\.
.
.TP
\fB\-m\fR \fB\-\-multiple\fR
Multiple input files\. Compressed file names will be appended a \fB\.lz4\fR suffix\. This mode also reduces notification level\. Can also be used to list multiple files\. \fBlz4 \-m\fR has a behavior equivalent to \fBgzip \-k\fR (it preserves source files by default)\.
2016-11-28 11:43:01 +00:00
.
.TP
\fB\-r\fR
operate recursively on directories\. This mode also sets \fB\-m\fR (multiple input files)\.
2016-11-28 07:23:40 +00:00
.
.TP
\fB\-B#\fR
Block size [4\-7](default : 7)
.
.br
\fB\-B4\fR= 64KB ; \fB\-B5\fR= 256KB ; \fB\-B6\fR= 1MB ; \fB\-B7\fR= 4MB
.
.TP
\fB\-BI\fR
Produce independent blocks (default)
.
.TP
2016-11-28 07:23:40 +00:00
\fB\-BD\fR
Blocks depend on predecessors (improves compression ratio, more noticeable on small blocks)
2016-11-28 07:23:40 +00:00
.
.TP
\fB\-\-[no\-]frame\-crc\fR
Select frame checksum (default:enabled)
.
.TP
\fB\-\-[no\-]content\-size\fR
Header includes original size (default:not present)
.
.br
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\.
.
.TP
2016-11-28 07:23:40 +00:00
\fB\-\-[no\-]sparse\fR
Sparse mode support (default:enabled on file, disabled on stdout)
.
.TP
\fB\-l\fR
2016-11-28 11:43:01 +00:00
Use Legacy format (typically for Linux Kernel compression)
2016-11-28 07:23:40 +00:00
.
.br
2016-11-28 11:43:01 +00:00
Note : \fB\-l\fR is not compatible with \fB\-m\fR (\fB\-\-multiple\fR) nor \fB\-r\fR
2015-03-22 12:42:00 +00:00
.
.SS "Other options"
2016-11-28 07:23:40 +00:00
.
.TP
2016-11-28 07:23:40 +00:00
\fB\-v\fR \fB\-\-verbose\fR
Verbose mode
.
.TP
2016-11-28 07:23:40 +00:00
\fB\-q\fR \fB\-\-quiet\fR
Suppress warnings and real\-time statistics; specify twice to suppress errors too
.
2015-03-22 12:42:00 +00:00
.TP
2016-11-28 07:23:40 +00:00
\fB\-h\fR \fB\-H\fR \fB\-\-help\fR
Display help/long help and exit
.
.TP
2016-11-28 07:23:40 +00:00
\fB\-V\fR \fB\-\-version\fR
Display Version number and exit
.
.TP
2016-11-28 07:23:40 +00:00
\fB\-k\fR \fB\-\-keep\fR
2016-11-28 11:43:01 +00:00
Preserve source files (default behavior)
.
.TP
\fB\-\-rm\fR
Delete source files on successful compression or decompression
2016-11-05 01:29:07 +00:00
.
2017-08-07 04:04:46 +00:00
.TP
\fB\-\-\fR
Treat all subsequent arguments as files
.
2016-11-05 01:29:07 +00:00
.SS "Benchmark mode"
2016-11-28 07:23:40 +00:00
.
2016-11-05 01:29:07 +00:00
.TP
2016-11-28 07:23:40 +00:00
\fB\-b#\fR
Benchmark file(s), using # compression level
.
.TP
2016-11-28 07:23:40 +00:00
\fB\-e#\fR
Benchmark multiple compression levels, from b# to e# (included)
.
.TP
2016-11-28 07:23:40 +00:00
\fB\-i#\fR
Minimum evaluation time in seconds [1\-9] (default : 3)
2016-11-28 07:23:40 +00:00
.
.SH "BUGS"
Report bugs at: https://github\.com/lz4/lz4/issues
.
.SH "AUTHOR"
Yann Collet