This is the most space-efficient compression utility used in Linux. The trade-off for compression is a slower speed of compression for a higher compression ratio.
The following table lists the xz compression command and its description with some examples:
Command |
Description |
xz * |
Compresses all files in the current directory and each compressed file is renamed with the .xz extension |
xz myfile |
Compresses the myfile file to myfile.xz with the default compression level (6); deletes the original myfile after compression |
xz -dk |
Decompresses myfile.xz to myfile and preserves myfile.xz after decompression |
xz -d *.xz or unxz |
Decompresses all files with the extension .xz in the current working directory |
The examples of xz command usage are shown in the following screenshot: