
So we’ve demonstrated that xz does indeed create much smaller archives than gzip.
Tar xz create archive#
But at 70 seconds, xz also took nearly 18 times as long! Compression levels six and beyond hugely increased the compression time for a negligible 1% reduction in archive size

To test this claim, we used the same 818 MB CSV file, and the same computer with six CPU cores and hyperthreading, as we used to test gzip in Linux. Previously, we stated that xz creates smaller archives than gzip.

Here, we specify the minimum compression level 1: tar cvf -use-compress-program='xz -1' *.csv We use this option to set the compression level, too. From man tar: -J, -xz Filter the archive through xz (1). Like so tar -cv /path/to/dir pixz -p4 > output.tpxz joelostblom. It is a great way to control the number of threads used for parallel compressing without having to create an intermediate. Tar allows setting the compression program through the –use-compress-program option. Note that tar can do all this for you, theres no reason to first create a tar archive and then compress it, you can create it compressed: tar -cJvf archive.tar file 1-5.txt That will produce . Modern versions of tar support the xz archive format (GNU tar, since 1.22 in 2009, Busybox since 1.17.0 in 2010). Which xz compression level does tar pick? It depends on our version of tar, but it probably is the default compression level 6. Unlike xz and gzip, tar doesn’t delete the input files after it creates the archive.Because of the v option, tar shows which files are added to the archive.The J option enables compression with xz.We compress all files with a csv extension in the current directory into the compressed archive,.
