Forever & AlwaysLINUX COMMAND ATLAS

LINUX COMMAND ATLAS · COMMAND GUIDE

Linux xz command

Compress files using xz. The -k flag keeps the original file.

XZ Utils

Syntax

Command form
xz [OPTION]... [FILE]...

Common options

6 options
OptionWhat it does
-z, --compressCompress (default operation).
-d, --decompressDecompress.
-k, --keepKeep the input file.
-c, --stdoutWrite results to standard output.
-T N, --threads=NUse up to N threads (where supported).
-0 to -9Set compression preset; higher values usually use more resources.

Usage examples

2 examples

Compress files using xz. The -k flag keeps the original file.

xz -k data.csv

Decompress while keeping the compressed file.

xz -dk data.csv.xz

Notes

The default behaviour may replace input files. High compression presets can use substantial memory and processing time.