LZ4(1) Cosmopolitan User Commands -*-text-*- ๐๐๐๐ ๐น๐๐ฐ - lz4, unlz4, lz4cat - Compress or decompress .lz4 files ๐๐๐๐๐๐๐๐ ๐น๐๐ฐ [OฬฒPฬฒTฬฒIฬฒOฬฒNฬฒSฬฒ] [-|INPUT-FILE] OฬฒUฬฒTฬฒPฬฒUฬฒTฬฒ-ฬฒFฬฒIฬฒLฬฒEฬฒ ๐๐ป๐น๐๐ฐ is equivalent to ๐น๐๐ฐ -๐ฑ ๐น๐๐ฐ๐ฐ๐ฎ๐ is equivalent to ๐น๐๐ฐ -๐ฑ๐ฐ๐ณ๐บ When writing scripts that need to decompress files, it is recomโ mended to always use the name ๐น๐๐ฐ with appropriate arguments (๐น๐๐ฐ -๐ฑ or ๐น๐๐ฐ -๐ฑ๐ฐ) instead of the names ๐๐ป๐น๐๐ฐ and ๐น๐๐ฐ๐ฐ๐ฎ๐. ๐๐๐๐๐๐๐๐๐๐๐ ๐น๐๐ฐ is an extremely fast lossless compression algorithm, based on ๐ฏ๐๐๐ฒ-๐ฎ๐น๐ถ๐ด๐ป๐ฒ๐ฑ ๐๐๐ณ๐ณ family of compression scheme. ๐น๐๐ฐ offers comโ pression 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 .๐น๐๐ฐ format. ๐๐ถ๐ณ๐ณ๐ฒ๐ฟ๐ฒ๐ป๐ฐ๐ฒ ๐ฏ๐ฒ๐๐๐ฒ๐ฒ๐ป ๐น๐๐ฐ ๐ฎ๐ป๐ฑ ๐ด๐๐ถ๐ฝ ๐น๐๐ฐ supports a command line syntax similar bฬฒuฬฒtฬฒ nฬฒoฬฒtฬฒ iฬฒdฬฒeฬฒnฬฒtฬฒiฬฒcฬฒaฬฒlฬฒ to ๐ด๐๐ถ๐ฝ(๐ญ). Differences are : ยท ๐น๐๐ฐ preserves original files ยท ๐น๐๐ฐ compresses a single file by default (see -๐บ for multiple files) ยท ๐น๐๐ฐ ๐ณ๐ถ๐น๐ฒ๐ญ ๐ณ๐ถ๐น๐ฒ๐ฎ means : compress file1 iฬฒnฬฒtฬฒoฬฒ file2 ยท ๐น๐๐ฐ ๐ณ๐ถ๐น๐ฒ.๐น๐๐ฐ will default to decompression (use -๐ to force compression) ยท ๐น๐๐ฐ shows real-time notification statistics during compresโ sion or decompression of a single file (use -๐พ to silence them) ยท If no destination name is provided, result is sent to ๐๐๐ฑ๐ผ๐๐ eฬฒxฬฒcฬฒeฬฒpฬฒtฬฒ iฬฒfฬฒ sฬฒtฬฒdฬฒoฬฒuฬฒtฬฒ iฬฒsฬฒ tฬฒhฬฒeฬฒ cฬฒoฬฒnฬฒsฬฒoฬฒlฬฒeฬฒ. ยท If no destination name is provided, ๐ฎ๐ป๐ฑ if ๐๐๐ฑ๐ผ๐๐ is the conโ sole, ๐ณ๐ถ๐น๐ฒ is compressed into ๐ณ๐ถ๐น๐ฒ.๐น๐๐ฐ. ยท As a consequence of previous rules, note the following examโ ple : ๐น๐๐ฐ ๐ณ๐ถ๐น๐ฒ | ๐ฐ๐ผ๐ป๐๐๐บ๐ฒ๐ฟ sends compressed data to ๐ฐ๐ผ๐ป๐๐๐บ๐ฒ๐ฟ through ๐๐๐ฑ๐ผ๐๐, hence it does nฬฒoฬฒtฬฒ create ๐ณ๐ถ๐น๐ฒ.๐น๐๐ฐ. ยท Another consequence of those rules is that to run ๐น๐๐ฐ under ๐ป๐ผ๐ต๐๐ฝ, you should provide a destination file: ๐ป๐ผ๐ต๐๐ฝ ๐น๐๐ฐ ๐ณ๐ถ๐น๐ฒ ๐ณ๐ถ๐น๐ฒ.๐น๐๐ฐ, because ๐ป๐ผ๐ต๐๐ฝ writes the specified commandยดs output to a file. Default behaviors can be modified by opt-in commands, detailed below. ยท ๐น๐๐ฐ -๐บ makes it possible to provide multiple input filenames, which will be compressed into files using suffix .๐น๐๐ฐ. Progress notifications are also disabled by default (use -๐ to enable them). This mode has a behavior which more closely mimics ๐ด๐๐ถ๐ฝ command line, with the main remaining difference being that source files are preserved by default. ยท Similarly, ๐น๐๐ฐ -๐บ -๐ฑ can decompress multiple *.๐น๐๐ฐ files. ยท Itยดs possible to opt-in to erase source files on successful compression or decompression, using --๐ฟ๐บ command. ยท Consequently, ๐น๐๐ฐ -๐บ --๐ฟ๐บ behaves the same as ๐ด๐๐ถ๐ฝ. ๐๐ผ๐ป๐ฐ๐ฎ๐๐ฒ๐ป๐ฎ๐๐ถ๐ผ๐ป ๐ผ๐ณ .๐น๐๐ฐ ๐ณ๐ถ๐น๐ฒ๐ It is possible to concatenate .๐น๐๐ฐ files as is. ๐น๐๐ฐ will decomโ press such files as if they were a single .๐น๐๐ฐ file. For example: lz4 file1 > foo.lz4 lz4 file2 >> foo.lz4 Then ๐น๐๐ฐ๐ฐ๐ฎ๐ ๐ณ๐ผ๐ผ.๐น๐๐ฐ is equivalent to ๐ฐ๐ฎ๐ ๐ณ๐ถ๐น๐ฒ๐ญ ๐ณ๐ถ๐น๐ฒ๐ฎ. ๐๐๐๐๐๐๐ ๐๐ต๐ผ๐ฟ๐ ๐ฐ๐ผ๐บ๐บ๐ฎ๐ป๐ฑ๐ ๐ฐ๐ผ๐ป๐ฐ๐ฎ๐๐ฒ๐ป๐ฎ๐๐ถ๐ผ๐ป In some cases, some options can be expressed using short command -๐ or long command --๐น๐ผ๐ป๐ด-๐๐ผ๐ฟ๐ฑ. Short commands can be concateโ nated together. For example, -๐ฑ -๐ฐ is equivalent to -๐ฑ๐ฐ. Long commands cannot be concatenated. They must be clearly separated by a space. ๐๐๐น๐๐ถ๐ฝ๐น๐ฒ ๐ฐ๐ผ๐บ๐บ๐ฎ๐ป๐ฑ๐ When multiple contradictory commands are issued on a same command line, only the latest one will be applied. ๐๐ฝ๐ฒ๐ฟ๐ฎ๐๐ถ๐ผ๐ป ๐บ๐ผ๐ฑ๐ฒ -๐ --๐ฐ๐ผ๐บ๐ฝ๐ฟ๐ฒ๐๐ Compress. This is the default operation mode when no operโ ation mode option is specified, no other operation mode is implied from the command name (for example, ๐๐ป๐น๐๐ฐ implies --๐ฑ๐ฒ๐ฐ๐ผ๐บ๐ฝ๐ฟ๐ฒ๐๐), nor from the input file name (for example, a file extension .๐น๐๐ฐ implies --๐ฑ๐ฒ๐ฐ๐ผ๐บ๐ฝ๐ฟ๐ฒ๐๐ by default). -๐ can also be used to force compression of an already comโ pressed .๐น๐๐ฐ file. -๐ฑ --๐ฑ๐ฒ๐ฐ๐ผ๐บ๐ฝ๐ฟ๐ฒ๐๐ --๐๐ป๐ฐ๐ผ๐บ๐ฝ๐ฟ๐ฒ๐๐ Decompress. --๐ฑ๐ฒ๐ฐ๐ผ๐บ๐ฝ๐ฟ๐ฒ๐๐ is also the default operation when the input filename has an .๐น๐๐ฐ extension. -๐ --๐๐ฒ๐๐ Test the integrity of compressed .๐น๐๐ฐ files. The decomโ pressed data is discarded. No files are created nor removed. -๐ฏ# Benchmark mode, using # compression level. ๐๐ฝ๐ฒ๐ฟ๐ฎ๐๐ถ๐ผ๐ป ๐บ๐ผ๐ฑ๐ถ๐ณ๐ถ๐ฒ๐ฟ๐ -# 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. Recโ ommended 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. -๐ ๐ฑ๐ถ๐ฐ๐๐ถ๐ผ๐ป๐ฎ๐ฟ๐๐๐ฎ๐บ๐ฒ Compress, decompress or benchmark using dictionary dฬฒiฬฒcฬฒtฬฒiฬฒoฬฒโฬฒ nฬฒaฬฒrฬฒyฬฒNฬฒaฬฒmฬฒeฬฒ. Compression and decompression must use the same dictionary to be compatible. Using a different dictionary during decompression will either abort due to decompresโ sion error, or generate a checksum error. -๐ณ --[๐ป๐ผ-]๐ณ๐ผ๐ฟ๐ฐ๐ฒ This option has several effects: If the target file already exists, overwrite it without prompting. When used with --๐ฑ๐ฒ๐ฐ๐ผ๐บ๐ฝ๐ฟ๐ฒ๐๐ and ๐น๐๐ฐ cannot recognize the type of the source file, copy the source file as is to standard output. This allows ๐น๐๐ฐ๐ฐ๐ฎ๐ --๐ณ๐ผ๐ฟ๐ฐ๐ฒ to be used like ๐ฐ๐ฎ๐ (๐ญ) for files that have not been compressed with ๐น๐๐ฐ. -๐ฐ --๐๐๐ฑ๐ผ๐๐ --๐๐ผ-๐๐๐ฑ๐ผ๐๐ Force write to standard output, even if it is the console. -๐บ --๐บ๐๐น๐๐ถ๐ฝ๐น๐ฒ Multiple input files. Compressed file names will be appended a .๐น๐๐ฐ suffix. This mode also reduces notificaโ tion level. ๐น๐๐ฐ -๐บ has a behavior equivalent to ๐ด๐๐ถ๐ฝ -๐ธ (it preserves source files by default). -๐ฟ operate recursively on directories. This mode also sets -๐บ (multiple input files). -๐# Block size [4-7](default : 7) -๐๐ฐ= 64KB ; -๐๐ฑ= 256KB ; -๐๐ฒ= 1MB ; -๐๐ณ= 4MB -๐๐ Block Dependency (improves compression ratio on small blocks) --๐ณ๐ฎ๐๐[=#] switch to ultra-fast compression levels. If =# is not present, it defaults to ๐ญ. The higher the value, the faster the compression speed, at the cost of some compresโ sion ratio. This setting overwrites compression level if one was set previously. Similarly, if a compression level is set after --๐ณ๐ฎ๐๐, it overrides it. --[๐ป๐ผ-]๐ณ๐ฟ๐ฎ๐บ๐ฒ-๐ฐ๐ฟ๐ฐ Select frame checksum (default:enabled) --[๐ป๐ผ-]๐ฐ๐ผ๐ป๐๐ฒ๐ป๐-๐๐ถ๐๐ฒ Header includes original size (default:not present) 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. --[๐ป๐ผ-]๐๐ฝ๐ฎ๐ฟ๐๐ฒ Sparse mode support (default:enabled on file, disabled on stdout) -๐น Use Legacy format (typically for Linux Kernel compression) Note : -๐น is not compatible with -๐บ (--๐บ๐๐น๐๐ถ๐ฝ๐น๐ฒ) nor -๐ฟ ๐๐๐ต๐ฒ๐ฟ ๐ผ๐ฝ๐๐ถ๐ผ๐ป๐ -๐ --๐๐ฒ๐ฟ๐ฏ๐ผ๐๐ฒ Verbose mode -๐พ --๐พ๐๐ถ๐ฒ๐ Suppress warnings and real-time statistics; specify twice to suppress errors too -๐ต -๐ --๐ต๐ฒ๐น๐ฝ Display help/long help and exit -๐ --๐๐ฒ๐ฟ๐๐ถ๐ผ๐ป Display Version number and exit -๐ธ --๐ธ๐ฒ๐ฒ๐ฝ Preserve source files (default behavior) --๐ฟ๐บ Delete source files on successful compression or decomโ pression -- Treat all subsequent arguments as files ๐๐ฒ๐ป๐ฐ๐ต๐บ๐ฎ๐ฟ๐ธ ๐บ๐ผ๐ฑ๐ฒ -๐ฏ# Benchmark file(s), using # compression level -๐ฒ# Benchmark multiple compression levels, from b# to e# (included) -๐ถ# Minimum evaluation time in seconds [1-9] (default : 3) ๐๐๐๐ Report bugs at: https://github.com/lz4/lz4/issues ๐๐๐๐๐๐ Yann Collet lz4 1.8.3 September 2018 LZ4(1)