I tried to run:
tar -zxvf name.tar.xz
but all I got was:
tar: Child returned status 2 tar: Error is not recoverable: exiting now
z flag of GNU tar (which is the version of
tar shipped with Ubuntu) is used to speciy that the archive being processed is compressed using
gzip, which is usually indicated by the
.tar.gz (or, more rarely,
.tgz) extension. In GNU tar, it is an error to use the
z flag if the archive is not compressed with
gzip, as you experience now.
Archives using the
.tar.xz extension are compressed with xz, and the corresponding flag in GNU tar is
J. Hence, replacing
J in your command should solve your problem. In addition, you may get a "command not found" error if the xz tools are not installed on your system, which can be remedied by installing the
Alternatively, you can simply omit the filetype-related flag altogether, and simply use
-xvf; in that case
tar will attempt to autodetect the compression format by analyzing the file. (You can probably also dispense with the
v flag; it just prints a list of the extracted files, which is not usually useful.)
.xz is "A compression format using LZMA2 to yield very high compression ratios" and should be extracted with
ar is installed by default as part of GNU utils).
arprogram creates, modifies, and extracts from archives. An archive is a single file holding a collection of other files in a structure that makes it possible to retrieve the original individual files (called members of the archive).
There are more tools (like
tar) but whatever other tool you use: make sure that that tool supports this ->
The original files' contents, mode (permissions), timestamp, owner, and group are preserved in the archive, and can be restored on extraction.