README.md
1Command Line Interface for LZ4 library
2============================================
3
4### Build
5The Command Line Interface (CLI) can be generated
6using the `make` command without any additional parameters.
7
8The `Makefile` script supports all [standard conventions](https://www.gnu.org/prep/standards/html_node/Makefile-Conventions.html),
9including standard targets (`all`, `install`, `clean`, etc.)
10and standard variables (`CC`, `CFLAGS`, `CPPFLAGS`, etc.).
11
12For advanced use cases, there are targets to different variations of the CLI:
13- `lz4` : default CLI, with a command line syntax close to gzip
14- `lz4c` : Same as `lz4` with additional support legacy lz4 commands (incompatible with gzip)
15- `lz4c32` : Same as `lz4c`, but forced to compile in 32-bits mode
16
17The CLI generates and decodes [LZ4-compressed frames](../doc/lz4_Frame_format.md).
18
19
20#### Aggregation of parameters
21CLI supports aggregation of parameters i.e. `-b1`, `-e18`, and `-i1` can be joined into `-b1e18i1`.
22
23
24#### Benchmark in Command Line Interface
25CLI includes in-memory compression benchmark module for lz4.
26The benchmark is conducted using a given filename.
27The file is read into memory.
28It makes benchmark more precise as it eliminates I/O overhead.
29
30The benchmark measures ratio, compressed size, compression and decompression speed.
31One can select compression levels starting from `-b` and ending with `-e`.
32The `-i` parameter selects a number of seconds used for each of tested levels.
33
34
35
36#### Usage of Command Line Interface
37The full list of commands can be obtained with `-h` or `-H` parameter:
38```
39Usage :
40 lz4 [arg] [input] [output]
41
42input : a filename
43 with no FILE, or when FILE is - or stdin, read standard input
44Arguments :
45 -1 : Fast compression (default)
46 -9 : High compression
47 -d : decompression (default for .lz4 extension)
48 -z : force compression
49 -D FILE: use FILE as dictionary
50 -f : overwrite output without prompting
51 -k : preserve source files(s) (default)
52--rm : remove source file(s) after successful de/compression
53 -h/-H : display help/long help and exit
54
55Advanced arguments :
56 -V : display Version number and exit
57 -v : verbose mode
58 -q : suppress warnings; specify twice to suppress errors too
59 -c : force write to standard output, even if it is the console
60 -t : test compressed file integrity
61 -m : multiple input files (implies automatic output filenames)
62 -r : operate recursively on directories (sets also -m)
63 -l : compress using Legacy format (Linux kernel compression)
64 -B# : cut file into blocks of size # bytes [32+]
65 or predefined block size [4-7] (default: 7)
66 -BD : Block dependency (improve compression ratio)
67 -BX : enable block checksum (default:disabled)
68--no-frame-crc : disable stream checksum (default:enabled)
69--content-size : compressed frame includes original size (default:not present)
70--[no-]sparse : sparse mode (default:enabled on file, disabled on stdout)
71--favor-decSpeed: compressed files decompress faster, but are less compressed
72--fast[=#]: switch to ultra fast compression level (default: 1)
73
74Benchmark arguments :
75 -b# : benchmark file(s), using # compression level (default : 1)
76 -e# : test all compression levels from -bX to # (default : 1)
77 -i# : minimum evaluation time in seconds (default : 3s)```
78```
79
80#### License
81
82All files in this directory are licensed under GPL-v2.
83See [COPYING](COPYING) for details.
84The text of the license is also included at the top of each source file.
85