XZ providers higher compression rate than gzip by sacrificing compression speed. Which is suitable for long-term archiving
Compress
XZ_OPT="-e9 -T0" tar cJvf compressed.xz dir/
-e9
means compression level at level 9 extreme (man xz
for more details in manual)-T0
means compress by using all threads on CPU
Decompress
tar -xvzf compressed.xz