+3 votes
373 views
How to unzip .tar.xz files in Linux

in Guides by (552k points)
reopened | 373 views

1 Answer

+4 votes
Best answer

How to unzip .tar.xz files in Linux.
Why use tar.xz instead of tar.gz? Is tar.xz better than Gzip (tar.gz)?

Compression and decompression formats evolve while advancing technologies to meet new needs. This is the case of the tar.xz format or also known simply as .xz . You might have downloaded a file with this extension and in this tutorial we show you how to unzip .tar.xz files in Linux .

image

Maybe the first thing that comes to your mind is to extract the .tar.gz with the tar -zxvf archivo.tar.xz command, but it will not work and will show the following error:

gzip: stdin: not in gzip format
tar: Child returned status 1
tar: Error is not recoverable: exiting now

How to unzip .tar.xz files in Linux.

In the vast majority of current Linux systems it is not necessary to install any application or library to unzip files with extension .xz , we just have to execute the following command from the console:
tar -Jxvf archivo.tar.xz

It is very important to note that I have used the letter J in uppercase , since if you put it in lowercase it will give you an error. Actually, when we decompress it is not necessary to include this parameter J , since the tar tool itself is able to identify the type of file. Then, we can directly use the tar -xvf archivo.tar.xz command and we will get the same results.

The parameter J if it is important to include it when we want to compress with the format tar.xz , being then the command:
tar -Jcvf archivo.tar.xz documento.txt

Why use tar.xz instead of tar.gz? Is tar.xz better than Gzip (tar.gz)?

In this section I will extend a bit talking about this .xz format that seems to be gaining special importance when sharing files on the internet.

The short answer is that .xz is a compression format that uses the LZMA2 compression algorithm and offers greater efficiency than Gzip and even bzip2. With .xz get smaller file sizes, which are ideal for saving bandwidth in internet transfers.

If we compare Gzip, the .xz format has the disadvantage that it requires more compression and decompression time, in addition to a larger amount of memory, but it offers us greater compression ratios.

However, if we compare it with bzip2 it is more efficient both in compression ratio and in compression time, hence many users have already adopted the .xz format as a replacement for bzip2 (.bz2) .

To answer the question of whether Gzip is better than xz or why use one or the other, we have to point to its use, since we cannot say that one is better than the other, but that they are used in different scenarios . When we are going to work on systems with limited memory, it is preferable to use Gzip, since it needs less resources. If what we want is to compress a file to share through the internet or a local network and we have enough RAM, the ideal is to use .xz to get a smaller file and accelerate the transfer of it.

Finally, to say that many web pages that provide recognized software already use this compression format, for example when you download the Linux Kernel source code from https://www.kernel.org/ and I also found it in the download of Portable telegram for Linux .


by (3.5m points)

Related questions

+4 votes
1 answer
+5 votes
1 answer
+5 votes
1 answer
+5 votes
1 answer
+3 votes
1 answer
asked Aug 9, 2019 in Guides by backtothefuture (552k points) | 253 views
Sponsored articles cost $40 per post. You can contact us via Feedback

Most popular questions within the last 30 days

10,659 questions
10,791 answers
510 comments
3 users