tar -I pxz -cf NAME-OF-COMPRESSED-FILE.tar.xz SOURCEDIRECTORY/
When using pigz for parallel gz compresion
1
tar -c --use-compress-program=pigz -f NAME.tar.gz directory/
Create tar.xz with more options
The -9 signifies compression level from 1 - 9, with 9 being highest compression. It is preferable to use 4-5 for best peformance to compression tradeoff. The -T is CPU cores. 0 uses all cores.
1
tar -c -I 'xz -9 -T0' -f archivename.tar.xz filesAndor directories/