Archiving
Compressor xz
Compression levels
- -0..- -3:- -0sometimes works faster than- gzip, but compresses much better;
- -4..- -6: good to very good compression while maintaining reasonable decompressor memory usage;
- -7..- -9: similar to- -6, but with higher compressor and decompressor memory requirements.
Environment variables
- XZ_OPT: Options for the current command.
Examples
Compress file to xz format:
xz filename
Compress the file without deleting the original (option -k):
xz -k filename
Unpack xz file (option -d, –decompress, –uncompress):
xz -d filename.xz
More information (optional -v):
xz -v -d filename.xz
Unpack the file and write to standard output (option -c):
xz -dc filename.xz
Compress the file using the fastest compression (option -0):
xz -0 filename
Compress file using better compression (option -9):
xz -9 filename
Specify the number of working threads used (if selected, 0the number of threads is calculated automatically) (option -T0):
xz -v -T0 -9 filename
Compress the entire directory:
tar -cf - dir1 | xz -9ze -T0 >dir1.txz
Using tarwith xzto compress an entire directory:
tar -cJvf archive.tar.xz dir1
Compressor zstd
Repository: https://github.com/facebook/zstd Website: https://facebook.github.io/zstd/
tar
Examples
Specifying parameters for compression (option -I, –use-compress-program):
tar --use-compress-program='xz -9 -T0' cvf archive.tar.xz directory
Specifying options for compression using environment variables:
xz, XZ_OPT: options for the current command:
XZ_OPT="-9 -T0" tar cJvf archive.tar.xz directory
xz, XZ_DEFAULTS: global options:
export XZ_DEFAULTS="-9 -T0"
tar cJvf archive.tar.xz directory
