1*01826a49SYabin CuiCommand Line Interface for Zstandard library 2*01826a49SYabin Cui============================================ 3*01826a49SYabin Cui 4*01826a49SYabin CuiCommand Line Interface (CLI) can be created using the `make` command without any additional parameters. 5*01826a49SYabin CuiThere are however other Makefile targets that create different variations of CLI: 6*01826a49SYabin Cui- `zstd` : default CLI supporting gzip-like arguments; includes dictionary builder, benchmark, and supports decompression of legacy zstd formats 7*01826a49SYabin Cui- `zstd_nolegacy` : Same as `zstd` but without support for legacy zstd formats 8*01826a49SYabin Cui- `zstd-small` : CLI optimized for minimal size; no dictionary builder, no benchmark, and no support for legacy zstd formats 9*01826a49SYabin Cui- `zstd-compress` : version of CLI which can only compress into zstd format 10*01826a49SYabin Cui- `zstd-decompress` : version of CLI which can only decompress zstd format 11*01826a49SYabin Cui 12*01826a49SYabin Cui 13*01826a49SYabin Cui### Compilation variables 14*01826a49SYabin Cui`zstd` scope can be altered by modifying the following `make` variables : 15*01826a49SYabin Cui 16*01826a49SYabin Cui- __HAVE_THREAD__ : multithreading is automatically enabled when `pthread` is detected. 17*01826a49SYabin Cui It's possible to disable multithread support, by setting `HAVE_THREAD=0`. 18*01826a49SYabin Cui Example : `make zstd HAVE_THREAD=0` 19*01826a49SYabin Cui It's also possible to force multithread support, using `HAVE_THREAD=1`. 20*01826a49SYabin Cui In which case, linking stage will fail if neither `pthread` nor `windows.h` library can be found. 21*01826a49SYabin Cui This is useful to ensure this feature is not silently disabled. 22*01826a49SYabin Cui 23*01826a49SYabin Cui- __ZSTD_LEGACY_SUPPORT__ : `zstd` can decompress files compressed by older versions of `zstd`. 24*01826a49SYabin Cui Starting v0.8.0, all versions of `zstd` produce frames compliant with the [specification](../doc/zstd_compression_format.md), and are therefore compatible. 25*01826a49SYabin Cui But older versions (< v0.8.0) produced different, incompatible, frames. 26*01826a49SYabin Cui By default, `zstd` supports decoding legacy formats >= v0.4.0 (`ZSTD_LEGACY_SUPPORT=4`). 27*01826a49SYabin Cui This can be altered by modifying this compilation variable. 28*01826a49SYabin Cui `ZSTD_LEGACY_SUPPORT=1` means "support all formats >= v0.1.0". 29*01826a49SYabin Cui `ZSTD_LEGACY_SUPPORT=2` means "support all formats >= v0.2.0", and so on. 30*01826a49SYabin Cui `ZSTD_LEGACY_SUPPORT=0` means _DO NOT_ support any legacy format. 31*01826a49SYabin Cui if `ZSTD_LEGACY_SUPPORT >= 8`, it's the same as `0`, since there is no legacy format after `7`. 32*01826a49SYabin Cui Note : `zstd` only supports decoding older formats, and cannot generate any legacy format. 33*01826a49SYabin Cui 34*01826a49SYabin Cui- __HAVE_ZLIB__ : `zstd` can compress and decompress files in `.gz` format. 35*01826a49SYabin Cui This is ordered through command `--format=gzip`. 36*01826a49SYabin Cui Alternatively, symlinks named `gzip` or `gunzip` will mimic intended behavior. 37*01826a49SYabin Cui `.gz` support is automatically enabled when `zlib` library is detected at build time. 38*01826a49SYabin Cui It's possible to disable `.gz` support, by setting `HAVE_ZLIB=0`. 39*01826a49SYabin Cui Example : `make zstd HAVE_ZLIB=0` 40*01826a49SYabin Cui It's also possible to force compilation with zlib support, using `HAVE_ZLIB=1`. 41*01826a49SYabin Cui In which case, linking stage will fail if `zlib` library cannot be found. 42*01826a49SYabin Cui This is useful to prevent silent feature disabling. 43*01826a49SYabin Cui 44*01826a49SYabin Cui- __HAVE_LZMA__ : `zstd` can compress and decompress files in `.xz` and `.lzma` formats. 45*01826a49SYabin Cui This is ordered through commands `--format=xz` and `--format=lzma` respectively. 46*01826a49SYabin Cui Alternatively, symlinks named `xz`, `unxz`, `lzma`, or `unlzma` will mimic intended behavior. 47*01826a49SYabin Cui `.xz` and `.lzma` support is automatically enabled when `lzma` library is detected at build time. 48*01826a49SYabin Cui It's possible to disable `.xz` and `.lzma` support, by setting `HAVE_LZMA=0`. 49*01826a49SYabin Cui Example : `make zstd HAVE_LZMA=0` 50*01826a49SYabin Cui It's also possible to force compilation with lzma support, using `HAVE_LZMA=1`. 51*01826a49SYabin Cui In which case, linking stage will fail if `lzma` library cannot be found. 52*01826a49SYabin Cui This is useful to prevent silent feature disabling. 53*01826a49SYabin Cui 54*01826a49SYabin Cui- __HAVE_LZ4__ : `zstd` can compress and decompress files in `.lz4` formats. 55*01826a49SYabin Cui This is ordered through commands `--format=lz4`. 56*01826a49SYabin Cui Alternatively, symlinks named `lz4`, or `unlz4` will mimic intended behavior. 57*01826a49SYabin Cui `.lz4` support is automatically enabled when `lz4` library is detected at build time. 58*01826a49SYabin Cui It's possible to disable `.lz4` support, by setting `HAVE_LZ4=0` . 59*01826a49SYabin Cui Example : `make zstd HAVE_LZ4=0` 60*01826a49SYabin Cui It's also possible to force compilation with lz4 support, using `HAVE_LZ4=1`. 61*01826a49SYabin Cui In which case, linking stage will fail if `lz4` library cannot be found. 62*01826a49SYabin Cui This is useful to prevent silent feature disabling. 63*01826a49SYabin Cui 64*01826a49SYabin Cui- __ZSTD_NOBENCH__ : `zstd` cli will be compiled without its integrated benchmark module. 65*01826a49SYabin Cui This can be useful to produce smaller binaries. 66*01826a49SYabin Cui In this case, the corresponding unit can also be excluded from compilation target. 67*01826a49SYabin Cui 68*01826a49SYabin Cui- __ZSTD_NODICT__ : `zstd` cli will be compiled without support for the integrated dictionary builder. 69*01826a49SYabin Cui This can be useful to produce smaller binaries. 70*01826a49SYabin Cui In this case, the corresponding unit can also be excluded from compilation target. 71*01826a49SYabin Cui 72*01826a49SYabin Cui- __ZSTD_NOCOMPRESS__ : `zstd` cli will be compiled without support for compression. 73*01826a49SYabin Cui The resulting binary will only be able to decompress files. 74*01826a49SYabin Cui This can be useful to produce smaller binaries. 75*01826a49SYabin Cui A corresponding `Makefile` target using this ability is `zstd-decompress`. 76*01826a49SYabin Cui 77*01826a49SYabin Cui- __ZSTD_NODECOMPRESS__ : `zstd` cli will be compiled without support for decompression. 78*01826a49SYabin Cui The resulting binary will only be able to compress files. 79*01826a49SYabin Cui This can be useful to produce smaller binaries. 80*01826a49SYabin Cui A corresponding `Makefile` target using this ability is `zstd-compress`. 81*01826a49SYabin Cui 82*01826a49SYabin Cui- __BACKTRACE__ : `zstd` can display a stack backtrace when execution 83*01826a49SYabin Cui generates a runtime exception. By default, this feature may be 84*01826a49SYabin Cui degraded/disabled on some platforms unless additional compiler directives are 85*01826a49SYabin Cui applied. When triaging a runtime issue, enabling this feature can provide 86*01826a49SYabin Cui more context to determine the location of the fault. 87*01826a49SYabin Cui Example : `make zstd BACKTRACE=1` 88*01826a49SYabin Cui 89*01826a49SYabin Cui 90*01826a49SYabin Cui### Aggregation of parameters 91*01826a49SYabin CuiCLI supports aggregation of parameters i.e. `-b1`, `-e18`, and `-i1` can be joined into `-b1e18i1`. 92*01826a49SYabin Cui 93*01826a49SYabin Cui 94*01826a49SYabin Cui### Symlink shortcuts 95*01826a49SYabin CuiIt's possible to invoke `zstd` through a symlink. 96*01826a49SYabin CuiWhen the name of the symlink has a specific value, it triggers an associated behavior. 97*01826a49SYabin Cui- `zstdmt` : compress using all cores available on local system. 98*01826a49SYabin Cui- `zcat` : will decompress and output target file using any of the supported formats. `gzcat` and `zstdcat` are also equivalent. 99*01826a49SYabin Cui- `gzip` : if zlib support is enabled, will mimic `gzip` by compressing file using `.gz` format, removing source file by default (use `--keep` to preserve). If zlib is not supported, triggers an error. 100*01826a49SYabin Cui- `xz` : if lzma support is enabled, will mimic `xz` by compressing file using `.xz` format, removing source file by default (use `--keep` to preserve). If xz is not supported, triggers an error. 101*01826a49SYabin Cui- `lzma` : if lzma support is enabled, will mimic `lzma` by compressing file using `.lzma` format, removing source file by default (use `--keep` to preserve). If lzma is not supported, triggers an error. 102*01826a49SYabin Cui- `lz4` : if lz4 support is enabled, will mimic `lz4` by compressing file using `.lz4` format. If lz4 is not supported, triggers an error. 103*01826a49SYabin Cui- `unzstd` and `unlz4` will decompress any of the supported format. 104*01826a49SYabin Cui- `ungz`, `unxz` and `unlzma` will do the same, and will also remove source file by default (use `--keep` to preserve). 105*01826a49SYabin Cui 106*01826a49SYabin Cui 107*01826a49SYabin Cui### Dictionary builder in Command Line Interface 108*01826a49SYabin CuiZstd offers a training mode, which can be used to tune the algorithm for a selected 109*01826a49SYabin Cuitype of data, by providing it with a few samples. The result of the training is stored 110*01826a49SYabin Cuiin a file selected with the `-o` option (default name is `dictionary`), 111*01826a49SYabin Cuiwhich can be loaded before compression and decompression. 112*01826a49SYabin Cui 113*01826a49SYabin CuiUsing a dictionary, the compression ratio achievable on small data improves dramatically. 114*01826a49SYabin CuiThese compression gains are achieved while simultaneously providing faster compression and decompression speeds. 115*01826a49SYabin CuiDictionary work if there is some correlation in a family of small data (there is no universal dictionary). 116*01826a49SYabin CuiHence, deploying one dictionary per type of data will provide the greater benefits. 117*01826a49SYabin CuiDictionary gains are mostly effective in the first few KB. Then, the compression algorithm 118*01826a49SYabin Cuiwill rely more and more on previously decoded content to compress the rest of the file. 119*01826a49SYabin Cui 120*01826a49SYabin CuiUsage of the dictionary builder and created dictionaries with CLI: 121*01826a49SYabin Cui 122*01826a49SYabin Cui1. Create the dictionary : `zstd --train PathToTrainingSet/* -o dictionaryName` 123*01826a49SYabin Cui2. Compress with the dictionary: `zstd FILE -D dictionaryName` 124*01826a49SYabin Cui3. Decompress with the dictionary: `zstd --decompress FILE.zst -D dictionaryName` 125*01826a49SYabin Cui 126*01826a49SYabin Cui 127*01826a49SYabin Cui### Benchmark in Command Line Interface 128*01826a49SYabin CuiCLI includes in-memory compression benchmark module for zstd. 129*01826a49SYabin CuiThe benchmark is conducted using given filenames. The files are read into memory and joined together. 130*01826a49SYabin CuiIt makes benchmark more precise as it eliminates I/O overhead. 131*01826a49SYabin CuiMultiple filenames can be supplied, as multiple parameters, with wildcards, 132*01826a49SYabin Cuior names of directories can be used as parameters with `-r` option. 133*01826a49SYabin Cui 134*01826a49SYabin CuiThe benchmark measures ratio, compressed size, compression and decompression speed. 135*01826a49SYabin CuiOne can select compression levels starting from `-b` and ending with `-e`. 136*01826a49SYabin CuiThe `-i` parameter selects minimal time used for each of tested levels. 137*01826a49SYabin Cui 138*01826a49SYabin Cui 139*01826a49SYabin Cui### Usage of Command Line Interface 140*01826a49SYabin CuiThe full list of options can be obtained with `-h` or `-H` parameter: 141*01826a49SYabin Cui``` 142*01826a49SYabin CuiUsage : 143*01826a49SYabin Cui zstd [args] [FILE(s)] [-o file] 144*01826a49SYabin Cui 145*01826a49SYabin CuiFILE : a filename 146*01826a49SYabin Cui with no FILE, or when FILE is - , read standard input 147*01826a49SYabin CuiArguments : 148*01826a49SYabin Cui -# : # compression level (1-19, default: 3) 149*01826a49SYabin Cui -d : decompression 150*01826a49SYabin Cui -D DICT: use DICT as Dictionary for compression or decompression 151*01826a49SYabin Cui -o file: result stored into `file` (only 1 output file) 152*01826a49SYabin Cui -f : overwrite output without prompting, also (de)compress links 153*01826a49SYabin Cui--rm : remove source file(s) after successful de/compression 154*01826a49SYabin Cui -k : preserve source file(s) (default) 155*01826a49SYabin Cui -h/-H : display help/long help and exit 156*01826a49SYabin Cui 157*01826a49SYabin CuiAdvanced arguments : 158*01826a49SYabin Cui -V : display Version number and exit 159*01826a49SYabin Cui -c : write to standard output (even if it is the console) 160*01826a49SYabin Cui -v : verbose mode; specify multiple times to increase verbosity 161*01826a49SYabin Cui -q : suppress warnings; specify twice to suppress errors too 162*01826a49SYabin Cui--no-progress : do not display the progress counter 163*01826a49SYabin Cui -r : operate recursively on directories 164*01826a49SYabin Cui--filelist FILE : read list of files to operate upon from FILE 165*01826a49SYabin Cui--output-dir-flat DIR : processed files are stored into DIR 166*01826a49SYabin Cui--output-dir-mirror DIR : processed files are stored into DIR respecting original directory structure 167*01826a49SYabin Cui--[no-]asyncio : use asynchronous IO (default: enabled) 168*01826a49SYabin Cui--[no-]check : during compression, add XXH64 integrity checksum to frame (default: enabled). If specified with -d, decompressor will ignore/validate checksums in compressed frame (default: validate). 169*01826a49SYabin Cui-- : All arguments after "--" are treated as files 170*01826a49SYabin Cui 171*01826a49SYabin CuiAdvanced compression arguments : 172*01826a49SYabin Cui--ultra : enable levels beyond 19, up to 22 (requires more memory) 173*01826a49SYabin Cui--long[=#]: enable long distance matching with given window log (default: 27) 174*01826a49SYabin Cui--fast[=#]: switch to very fast compression levels (default: 1) 175*01826a49SYabin Cui--adapt : dynamically adapt compression level to I/O conditions 176*01826a49SYabin Cui--patch-from=FILE : specify the file to be used as a reference point for zstd's diff engine 177*01826a49SYabin Cui -T# : spawns # compression threads (default: 1, 0==# cores) 178*01826a49SYabin Cui -B# : select size of each job (default: 0==automatic) 179*01826a49SYabin Cui--single-thread : use a single thread for both I/O and compression (result slightly different than -T1) 180*01826a49SYabin Cui--rsyncable : compress using a rsync-friendly method (-B sets block size) 181*01826a49SYabin Cui--exclude-compressed: only compress files that are not already compressed 182*01826a49SYabin Cui--stream-size=# : specify size of streaming input from `stdin` 183*01826a49SYabin Cui--size-hint=# optimize compression parameters for streaming input of approximately this size 184*01826a49SYabin Cui--target-compressed-block-size=# : generate compressed block of approximately targeted size 185*01826a49SYabin Cui--no-dictID : don't write dictID into header (dictionary compression only) 186*01826a49SYabin Cui--[no-]compress-literals : force (un)compressed literals 187*01826a49SYabin Cui--format=zstd : compress files to the .zst format (default) 188*01826a49SYabin Cui--format=gzip : compress files to the .gz format 189*01826a49SYabin Cui--format=xz : compress files to the .xz format 190*01826a49SYabin Cui--format=lzma : compress files to the .lzma format 191*01826a49SYabin Cui--format=lz4 : compress files to the .lz4 format 192*01826a49SYabin Cui 193*01826a49SYabin CuiAdvanced decompression arguments : 194*01826a49SYabin Cui -l : print information about zstd compressed files 195*01826a49SYabin Cui--test : test compressed file integrity 196*01826a49SYabin Cui -M# : Set a memory usage limit for decompression 197*01826a49SYabin Cui--[no-]sparse : sparse mode (default: disabled) 198*01826a49SYabin Cui 199*01826a49SYabin CuiDictionary builder : 200*01826a49SYabin Cui--train ## : create a dictionary from a training set of files 201*01826a49SYabin Cui--train-cover[=k=#,d=#,steps=#,split=#,shrink[=#]] : use the cover algorithm with optional args 202*01826a49SYabin Cui--train-fastcover[=k=#,d=#,f=#,steps=#,split=#,accel=#,shrink[=#]] : use the fast cover algorithm with optional args 203*01826a49SYabin Cui--train-legacy[=s=#] : use the legacy algorithm with selectivity (default: 9) 204*01826a49SYabin Cui -o DICT : DICT is dictionary name (default: dictionary) 205*01826a49SYabin Cui--maxdict=# : limit dictionary to specified size (default: 112640) 206*01826a49SYabin Cui--dictID=# : force dictionary ID to specified value (default: random) 207*01826a49SYabin Cui 208*01826a49SYabin CuiBenchmark arguments : 209*01826a49SYabin Cui -b# : benchmark file(s), using # compression level (default: 3) 210*01826a49SYabin Cui -e# : test all compression levels successively from -b# to -e# (default: 1) 211*01826a49SYabin Cui -i# : minimum evaluation time in seconds (default: 3s) 212*01826a49SYabin Cui -B# : cut file into independent chunks of size # (default: no chunking) 213*01826a49SYabin Cui -S : output one benchmark result per input file (default: consolidated result) 214*01826a49SYabin Cui--priority=rt : set process priority to real-time 215*01826a49SYabin Cui``` 216*01826a49SYabin Cui 217*01826a49SYabin Cui### Passing parameters through Environment Variables 218*01826a49SYabin CuiThere is no "generic" way to pass "any kind of parameter" to `zstd` in a pass-through manner. 219*01826a49SYabin CuiUsing environment variables for this purpose has security implications. 220*01826a49SYabin CuiTherefore, this avenue is intentionally restricted and only supports `ZSTD_CLEVEL` and `ZSTD_NBTHREADS`. 221*01826a49SYabin Cui 222*01826a49SYabin Cui`ZSTD_CLEVEL` can be used to modify the default compression level of `zstd` 223*01826a49SYabin Cui(usually set to `3`) to another value between 1 and 19 (the "normal" range). 224*01826a49SYabin Cui 225*01826a49SYabin Cui`ZSTD_NBTHREADS` can be used to specify a number of threads 226*01826a49SYabin Cuithat `zstd` will use for compression, which by default is `1`. 227*01826a49SYabin CuiThis functionality only exists when `zstd` is compiled with multithread support. 228*01826a49SYabin Cui`0` means "use as many threads as detected cpu cores on local system". 229*01826a49SYabin CuiThe max # of threads is capped at `ZSTDMT_NBWORKERS_MAX`, 230*01826a49SYabin Cuiwhich is either 64 in 32-bit mode, or 256 for 64-bit environments. 231*01826a49SYabin Cui 232*01826a49SYabin CuiThis functionality can be useful when `zstd` CLI is invoked in a way that doesn't allow passing arguments. 233*01826a49SYabin CuiOne such scenario is `tar --zstd`. 234*01826a49SYabin CuiAs `ZSTD_CLEVEL` and `ZSTD_NBTHREADS` only replace the default compression level 235*01826a49SYabin Cuiand number of threads respectively, they can both be overridden by corresponding command line arguments: 236*01826a49SYabin Cui`-#` for compression level and `-T#` for number of threads. 237*01826a49SYabin Cui 238*01826a49SYabin Cui 239*01826a49SYabin Cui### Long distance matching mode 240*01826a49SYabin CuiThe long distance matching mode, enabled with `--long`, is designed to improve 241*01826a49SYabin Cuithe compression ratio for files with long matches at a large distance (up to the 242*01826a49SYabin Cuimaximum window size, `128 MiB`) while still maintaining compression speed. 243*01826a49SYabin Cui 244*01826a49SYabin CuiEnabling this mode sets the window size to `128 MiB` and thus increases the memory 245*01826a49SYabin Cuiusage for both the compressor and decompressor. Performance in terms of speed is 246*01826a49SYabin Cuidependent on long matches being found. Compression speed may degrade if few long 247*01826a49SYabin Cuimatches are found. Decompression speed usually improves when there are many long 248*01826a49SYabin Cuidistance matches. 249*01826a49SYabin Cui 250*01826a49SYabin CuiBelow are graphs comparing the compression speed, compression ratio, and 251*01826a49SYabin Cuidecompression speed with and without long distance matching on an ideal use 252*01826a49SYabin Cuicase: a tar of four versions of clang (versions `3.4.1`, `3.4.2`, `3.5.0`, 253*01826a49SYabin Cui`3.5.1`) with a total size of `244889600 B`. This is an ideal use case as there 254*01826a49SYabin Cuiare many long distance matches within the maximum window size of `128 MiB` (each 255*01826a49SYabin Cuiversion is less than `128 MiB`). 256*01826a49SYabin Cui 257*01826a49SYabin CuiCompression Speed vs Ratio | Decompression Speed 258*01826a49SYabin Cui---------------------------|--------------------- 259*01826a49SYabin Cui |  260*01826a49SYabin Cui 261*01826a49SYabin Cui| Method | Compression ratio | Compression speed | Decompression speed | 262*01826a49SYabin Cui|:-------|------------------:|-------------------------:|---------------------------:| 263*01826a49SYabin Cui| `zstd -1` | `5.065` | `284.8 MB/s` | `759.3 MB/s` | 264*01826a49SYabin Cui| `zstd -5` | `5.826` | `124.9 MB/s` | `674.0 MB/s` | 265*01826a49SYabin Cui| `zstd -10` | `6.504` | `29.5 MB/s` | `771.3 MB/s` | 266*01826a49SYabin Cui| `zstd -1 --long` | `17.426` | `220.6 MB/s` | `1638.4 MB/s` | 267*01826a49SYabin Cui| `zstd -5 --long` | `19.661` | `165.5 MB/s` | `1530.6 MB/s` | 268*01826a49SYabin Cui| `zstd -10 --long`| `21.949` | `75.6 MB/s` | `1632.6 MB/s` | 269*01826a49SYabin Cui 270*01826a49SYabin CuiOn this file, the compression ratio improves significantly with minimal impact 271*01826a49SYabin Cuion compression speed, and the decompression speed doubles. 272*01826a49SYabin Cui 273*01826a49SYabin CuiOn the other extreme, compressing a file with few long distance matches (such as 274*01826a49SYabin Cuithe [Silesia compression corpus]) will likely lead to a deterioration in 275*01826a49SYabin Cuicompression speed (for lower levels) with minimal change in compression ratio. 276*01826a49SYabin Cui 277*01826a49SYabin CuiThe below table illustrates this on the [Silesia compression corpus]. 278*01826a49SYabin Cui 279*01826a49SYabin Cui[Silesia compression corpus]: https://sun.aei.polsl.pl//~sdeor/index.php?page=silesia 280*01826a49SYabin Cui 281*01826a49SYabin Cui| Method | Compression ratio | Compression speed | Decompression speed | 282*01826a49SYabin Cui|:-------|------------------:|------------------:|---------------------:| 283*01826a49SYabin Cui| `zstd -1` | `2.878` | `231.7 MB/s` | `594.4 MB/s` | 284*01826a49SYabin Cui| `zstd -1 --long` | `2.929` | `106.5 MB/s` | `517.9 MB/s` | 285*01826a49SYabin Cui| `zstd -5` | `3.274` | `77.1 MB/s` | `464.2 MB/s` | 286*01826a49SYabin Cui| `zstd -5 --long` | `3.319` | `51.7 MB/s` | `371.9 MB/s` | 287*01826a49SYabin Cui| `zstd -10` | `3.523` | `16.4 MB/s` | `489.2 MB/s` | 288*01826a49SYabin Cui| `zstd -10 --long`| `3.566` | `16.2 MB/s` | `415.7 MB/s` | 289*01826a49SYabin Cui 290*01826a49SYabin Cui 291*01826a49SYabin Cui### zstdgrep 292*01826a49SYabin Cui 293*01826a49SYabin Cui`zstdgrep` is a utility which makes it possible to `grep` directly a `.zst` compressed file. 294*01826a49SYabin CuiIt's used the same way as normal `grep`, for example : 295*01826a49SYabin Cui`zstdgrep pattern file.zst` 296*01826a49SYabin Cui 297*01826a49SYabin Cui`zstdgrep` is _not_ compatible with dictionary compression. 298*01826a49SYabin Cui 299*01826a49SYabin CuiTo search into a file compressed with a dictionary, 300*01826a49SYabin Cuiit's necessary to decompress it using `zstd` or `zstdcat`, 301*01826a49SYabin Cuiand then pipe the result to `grep`. For example : 302*01826a49SYabin Cui`zstdcat -D dictionary -qc -- file.zst | grep pattern` 303