I am trying to create a .tar.xz
compressed archive in one command. What is the specific syntax for that?
I have tried tar cf - file | xz file.tar.xz>
Switch -J
only works on newer systems. The universal command is:
To make .tar.xz archive
tar cf - directory/ | xz -z - > directory.tar.xz
Explanation
tar cf - directory
reads directory/ and starts putting it to TAR format. The output of this operation is generated on the standard output.
|
pipes standard output to the input of another program...
... which happens to be xz -z -
. XZ is configured to compress (-z
) the archive from standard input (-
).
You redirect the output from xz
to the tar.xz
file.