tar -cJvf resultfile.tar.xz files_to_compress
tar -xzvf resultfile.tar.xz
to extract the archive in current directory. How to use multi threading in both cases? I don't want to install any utilities.
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems. It only takes a minute to sign up.Sign up to join this community
tar -c -I 'xz -9 -T0' -f archive.tar.xz [list of files and folders]
This compresses a list of files and directories into an
.tar.xz archive. It does so by specifying the arguments to be passed to the
xz subprocess, which compresses the tar archive.
This is done using the
-I argument to tar, which tells
tar what program to use to compress the tar archive, and what arguments to pass to it. The
xz to use maximum compression. The
xz to use as many threads as you have CPUs.
You can use
XZ_OPT environment variables:
XZ_DEFAULTS is recommended to be used as a system wide configuration, typically set in a shell initialization script.
XZ_OPT is for passing options to
xz when run by a script or tool, e.g. GNU
Example: using multiple threads (
-T0) and max compression level (
XZ_OPT='-T0 -9' tar -cJf resultfile.tar.xz files_to_compress