How to Extract (Unzip) tar.xz File - MS TV Life.COM

How to Extract (Unzip) tar.xz File

Tips on how to Extract (Unzip) tar.xz File

The tar command permits you to create and extract tar archives. It helps an enormous vary of compression applications similar to gzip, bzip2, lzip, lzma, lzop, xz and compress.

Xz is a well-liked algorithm for compressing information based mostly on the LZMA algorithm. By conference, the title of a tar archive compressed with xz ends with both .tar.xz or .txz.

This text explains use the tar command to extract (or unzip) .tar.xz or .txz archives.

The tar utility is pre-installed by default on all Linux distributions and macOS.

To extract a tar.xz file, invoke the tar command with the --extract (-x) choice and specify the archive file title after the -f choice:

tar -xf archive.tar.xz

tar auto-detects compression kind and extracts the archive. The identical command can be utilized to extract tar archives compressed with different algorithms, similar to .tar.gz or .tar.bz2.

If the command-line is just not your factor, you need to use the GUI File supervisor. To extract (unzip) a tar.xz file merely right-click the file you wish to extract and choose “Extract”. Home windows customers want a device named 7zip to extract tar.xz information.

For extra verbose output, use the -v choice. This selection tells tar to show the names of the information being extracted on the terminal.

tar -xvf archive.tar.xz

By default, tar extracts the archive contents within the current working directory. To extract archive information in a particular listing, use the --directory (-C).

The next instance exhibits extract the archive contents to the /dwelling/linuxize/information listing:

tar -xf archive.tar.xz -C /dwelling/linuxize/information

To extract a particular file(s) from a tar.xz file, append a space-separated listing of file names to be extracted after the archive title:

tar -xf archive.tar.xz file1 file2

When extracting information, you could present their precise names together with the trail, as printed when the tar is invoked with the --list (-t) choice.

Extracting a number of directories from an archive is similar as extracting a number of information:

tar -xf archive.tar.xz dir1 dir2

When you attempt to extract a file that doesn’t exist within the archive, an error message much like the next shall be proven:

tar -xf archive.tar.xz README
tar: README: Not present in archive
tar: Exiting with failure standing on account of earlier errors

The --wildcards choice permits you to extract information from a tar.xz file based mostly on a wildcard sample. The sample have to be quoted to forestall the shell from decoding it.

For instance, to extract solely the information whose names finish in .png, you’d use:

tar -xf archive.tar.xz --wildcards '*.png'

When extracting a compressed tar.xz file by studying the archive from customary enter (often via piping), you could specify the decompression choice. The -J choice tells tar that the file is compressed with xz.

Within the instance under we’re downloading the Linux kernel utilizing the wget command and pipe its output to the tar command:

wget -c https://cdn.kernel.org/pub/linux/kernel/v5.x/linux-5.5.3.tar.xz -O - | sudo tar -xj

When you don’t specify a decompression choice, tar will present you which of them choice it’s best to use:

tar: Archive is compressed. Use -J choice
tar: Error is just not recoverable: exiting now

Itemizing tar.xz File Content material #

To listing the content material of a tar.xz file, use the --list (-t) choice:

tar -tf archive.tar.xz

The output will look one thing like this:

file1
file2
file3

When you add the --verbose (-v) choice, tar will print extra data, similar to proprietor, file measurement, timestamp ..and so on:

tar -tvf archive.tar.xz
-rw-r--r-- linuxize/customers       0 2020-02-15 01:19 file1
-rw-r--r-- linuxize/customers       0 2020-02-15 01:19 file2
-rw-r--r-- linuxize/customers       0 2020-02-15 01:19 file3

Conclusion #

tar.xz file is a Tar archive compressed with xz. To extract a tar.xz file, use the tar -xf command, adopted by the archive title.

When you’ve got any questions, please go away a remark under.

Copy link
Powered by Social Snap