Unpack the *.xz archive for Windows. What is the XZ file extension? Open xz file

These days we come across archive files very often and on all platforms: Windows, Mac or Linux. These could be programs, system or database backups, or simply an archive of files. We also often have to create our own archives in Linux in order to transfer several files to friends or upload to a file hosting service. Software packages, source codes, and many other files distributed on the Internet are distributed in the form of archives. Learning how to archive files in Linux through the terminal is very important; you may need it when you don’t have access to the graphical interface, or it will simply become more pleasant to work in the terminal over time.

In this manual, I want to take a detailed look at archiving utilities in Linux; we will look at not only the most popular and universal utility - tar, but also other lesser-known and popular compression algorithms.

It is important to note that archiving in Linux is not the same thing as compressing Linux files. Archiving is the process of combining several small files into one for the purpose of more convenient subsequent transfer, storage, encryption or compression. As I already said, archiving is performed by special utilities. We will not touch archiving files in the graphical interface, you will figure them out yourself, our topic is the terminal.

The most popular archiving utility for Linux is tar. It is used almost everywhere, for archiving sources, packaging packages. Other utilities are used for compression, depending on the compression algorithm, for example, zip, bz, xz, lzma, etc. First, archiving is performed, then compression, using separate programs. Automatic launch of some compression utilities for a newly created archive is supported in tar and other similar programs using special options.

Encryption is also a useful archiving feature. But now let's look at what utilities exist that can be used to archive Linux files and how to use them.

Tar

Tar is a standard utility used to archive Linux files. Gradually, it has grown from a small archiving program into a powerful tool that supports many archive options and compression algorithms. The program supports a large number of parameters. Let's look at its syntax and main parameters:

$tar options f file_to_write /folder_files_for_archive

Now let's look at the main options:

  • A- add a file to the archive
  • c- create an archive in Linux
  • d- compare archive files and unpacked files in the file system
  • j- compress the archive using Bzip
  • z- compress the archive using Gzip
  • r- add files to the end of the archive
  • t- show archive contents
  • u- update the archive relative to the file system
  • x- extract files from the archive
  • v- show detailed information about the work process
  • f- file for recording the archive
  • -C- unpack to the specified folder
  • --strip-components- discard n subfolders

Now let's look at archiving files in Linux. To create an archive use the following command:

tar -cvf archive.tar.gz /path/to/files

And to unpack the linux tar archive:

tar -xvf archive.tar.gz

It's very easy to remember to use the packaging option c - C reate, and for unpacking - x-e X tract.

The compressed archive is created in exactly the same way, only with the -z option, this is if gizp encryption was used; if bzip is needed, then the -j option is used:

tar -zcvf archive.tar.gz /path/to/files

$ tar -zxvf archive.tar.gz

For example, let's look at how to archive a folder in Linux:

tar -zcvf home.tar.gz ~/

Although we can do it differently, we get the same archive if we first create a regular archive using tar, and then compress it with a compression utility, only here we get more control over the compression process:

gzip archive.tar

You can also remove compression:

gunzip archive.tar.gz

We will look at compression utilities below.

To add a file to the archive use:

tar -rvf archive.tar file.txt

To extract a single file, the syntax is the same:

tar -xvf archive.tar file.txt

You can extract multiple files by matching pattern using the wildcard parameter, for example, extract all php files:

tar -xvf archive.tar --wildcards "*.php"

By default, you can unpack a linux tar archive into the current folder with the archive name; to unpack to the desired folder, use the -C switch:

tar -xvf archive.tar -C /path/to/dir

We've looked at the standard utility, now let's briefly look at its alternatives. There are not many of them, and most of them are already outdated.

Shar

Shar allows you to create self-extracting archives. It is essentially a shell script and requires a Bash or other Bourne Shell compatible shell to unpack. Shar has several advantages, but it is also potentially insecure since the archive is an executable file.

Shar options:

  • -o- save archive to file instead of standard output
  • -l- limit output file size
  • -L- limit the size of the output file and split it into parts
  • -n- the archive name will not be included in the header
  • -a- allow automatic generation of titles

Examples of using shar to archive a Linux folder:

Create a shar archive:

shar file_name.extension > filename.shar

Unpack the shar archive:

Ar

ar is a utility for creating and managing archives. Mainly used for archiving static libraries, but can be used to create any archives. Previously used quite often but was supplanted by the tar utility. Currently used only for creating and updating static library files.

  • - d- remove modules from the archive
  • -m- moving members in the archive
  • -p- print specific archive members
  • -q- quick addition
  • -r- add a member to the archive
  • -s- create an archive index
  • - a- add a new file to an existing archive

Now let's look at examples of use. Let's create a static library libmath.a from the object files substraction.o and division.o:

ar cr libmath.a substraction.o division.o

Now let's extract the files from the archive:

This way you can unpack any static library.

Cpio

cpio - means Copy in and out (copy input and output). This is another standard archiver for Linux. Actively used in the Red Hat package manager, as well as for creating initramfs. Archiving in Linux for regular files using this program is not applicable.

Utility options:

  • -a- reset the time it takes to access files after copying them
  • -A- add file
  • -d- create directories if necessary

Example of use. Create a cpio archive:

file1.o file2.o file3.o

ls | cpio -ov > /path/to/output_folder/obj.cpio

Unpack the archive:

cpio-idv< /path/to folder/obj.cpio

Archiving the linux folder also performs itself.

Compressing Archives in Linux

We looked at how to create an archive in Linux. Now let's talk about compression. As I said, special utilities are used for compression. Let's briefly look at a few of them

Gzip

The most commonly used is Gzip. This is a standard compression utility in Unix/Linux. For decompression, use gunzip or gzip -d First, let's look at its syntax:

$gzip options file

$ gunzip options file

Now let's look at the options:

  • -c- output archive to standard output
  • -d- unpack
  • -f- forcefully unpack or compress
  • -l- show information about the archive
  • -r- recursively iterate through directories
  • -0 - minimum compression level
  • -9 - maximum compression level

You have already seen examples of use in the description of the tar utility. For example, let's compress a file:

gzip -c file > archive.gz

Now let's unpack:

gunzip -c archive.gz

But to compress a folder in Linux, you will first have to archive it using tar, and only then compress the archive file using gzip.

Bzip

bzip2 is another alternative compression utility for Linux. It is more efficient than gzip, but is slower. To unpack, use the bunzip2 utility.

I will not describe the options of bzip2, they are similar to gzip. To create an archive on Linux use:

The file file.bz2 will be created in the current directory

Lzma

New and highly efficient compression algorithm. The syntax and options are also similar to Gzip. Use unlzma to unpack.

Xz

Another highly efficient compression algorithm. Backwards compatible with Lzma. The calling parameters are also similar to Gzip.

Zip

Cross-platform utility for creating compressed zip archives. Windows-compatible implementations of this algorithm. Zip archives are very often used for exchanging files on the Internet. With this utility you can compress both files and compress the linux folder.

Utility syntax:

$ zip options files

$ unzip options archive

Utility options:

  • -d delete file from archive
  • -r- traverse directories recursively
  • -0 - archive only, no compression
  • -9 - best compression ratio
  • -F- fix zip file
  • -e- encrypt files

To create a Zip archive in Linux, use.

- Extension (format) is the characters at the end of the file after the last dot.
- The computer determines the file type by its extension.
- By default, Windows does not show file name extensions.
- Some characters cannot be used in the file name and extension.
- Not all formats are related to the same program.
- Below are all the programs that can be used to open the XZ file.

Bandizip is a convenient archiver for Windows operating systems. The program supports most different formats and has a unique algorithm for skipping incompressible files. Bandizip is integrated into the context menu of Explorer, which greatly simplifies the management of the program itself, because all necessary operations, for example, creating archives or unpacking data, can be performed directly from Explorer. In addition, it has an encryption algorithm that allows you to protect the file from unwanted opening. In addition, the program has the function of setting a password for a file. This password is known to be impossible to hack...

Universal Extractor is a convenient utility for unpacking various archives, as well as some additional file types. This program is primarily suitable for those users who create archives on a computer, but only download various archives from the Internet and then unpack them. The Universal Extractor utility copes with this task quite well. It allows you to unpack all known archives, as well as dll, exe, mdi and other types of files. In fact, the program can serve, to some extent, as a kind of program installer, because it allows you to unpack some of the installers and then run...

HaoZip is a Chinese clone of the popular Winrar archiver, both in terms of functionality and interface as a whole. The archiver can work with all popular formats, including 7Z, ZIP, TAR, RAR, ISO, UDF, ACE, UUE, CAB, BZIP2, ARJ, JAR, LZH, RPM, Z, LZMA, NSIS, DEB, XAR, CPIO, SPLIT, WIM, IMG and others. In addition, using Haozip you can mount ISO images and view images through the built-in viewer, which is a very useful feature for archivers. As for the interface, the Chinese developers have done a good job here. They not only copied the design and functionality from the Winrar archiver, but also added...

WinRAR is a well-known program designed to work with archives. The utility includes a wide range of built-in capabilities. WinRAR compresses data faster than its competitors, saving disk space and user time. Supports well-known archive formats and is suitable for compressing multimedia files. Automatic file format recognition, a special data compression algorithm and an optimal packaging method are the advantages of the application. WinRAR can compress executive, multimedia files and object module libraries. The application allows you to divide archives into separate volumes and save them on different storage devices.

Ashampoo ZIP is an archiver program that helps you compress and store the necessary information. Works with a variety of formats, allowing users to send large documents in a compressed form. Ashampoo ZIP has a wide range of different functions. Using the application, you can create, unpack and split archives. In addition, the program supports reading, recovery, encryption, and instant conversion. The list of formats supported by Ashampoo ZIP is quite impressive. In addition to creating archives, the program supports unpacking documents in more than 30 different archive formats.

Every year, to improve and enhance the convenience of users, developers of various computer software release many interesting, convenient and high-quality programs that significantly help in their work. One of these programs is the latest development of the WinArc archiver. This utility is available for public use and with its help you can easily archive or unarchive any file that interests you. During operation, this utility uses all processor cores, thereby speeding up the archiving process. In addition, it has the function of adjusting the use of RAM, which will significantly reduce the load on your computer...

I recently downloaded an image of a fresh 8.2 file, I was surprised when I saw that the image was packed in .xz, I had never heard of this archive format before, it turns out XZ is a compressed data format that uses the LZMA2 algorithm and is designed to replace the LZMA format. Like the gzip and bzip2 formats, it is a single-file container, so it is usually used in conjunction with the tar format.

Out of habit, I tried to unpack it with WinRar, to which I received a response from him, saying that the archive was broken, or was not an archive 🙁 sad!

I found a DOS utility on the Internet for unpacking such archives, leaked it to myself, and posted it on my website, because... you need to have these things on hand)

We unpack the archive file, throw the xz.exe file into system32, unless of course we want to use it calmly, without entering the full path to it.
Working with the utility is very simple, for example, unpack a fresh distribution package:

Xz -d u:\FreeBSD-8.2-RELEASE-amd64-dvd1.iso.xz

You can also view all command keys:

C:\xz --help Usage: xz ... ... Compress or decompress FILEs in the .xz format. -z, --compress compression strength -d, --decompress decompression strength -t, --test check the integrity of the compressed file -l, --list list information about files.xz -k, --keep save (do not delete) input files -f, --force forced rewriting of the output file and (de)compression of links -c, --stdout write to standard output and do not delete input files -0 ... -9 compression preset; default 6; use the compressor *and* use the decompressor memory before using 7-9! -e, --extreme try to improve the compression ratio using more CPU time; does not affect decompressor memory requirements -q, --quiet suppress warnings; specify twice to suppress errors -v, --verbose be verbose; specify twice for even more detailed reporting -h, --help display this short help and exit -H, --long-help display detailed help (advanced options are also listed) -V, --version display the version number and exit

Well, how's everything)
Enjoy using the utility!)

The “double click, unpack” option is not bad. But not universal. Well, not as interesting as a bunch of ways to do it in the console! Therefore, another note in the style of “All the ways to do this.”

Perhaps the best choice for an archive that you want to make available for public download is zip-archive. Tools for unpacking it are available on almost all operating systems out of the box. Even in Windows there is a strange, but still zip unarchiver. If you use Linux / FreeBSD / MacOS, then your choice is unzip:

Unzip file.zip

In general, it is clear why ZIP has become popular. It uses the patent-free Deflate algorithm, which has long become almost a standard for compression: it is described in RFC 1951, and many people use it (the same gzip and png image storage format, I won’t list everything - ZIP is really great!).

Plus, the author of this format, Phil Katz, became quite famous in his time. At the dawn of the user Internet, during the BBS era, he optimized the ARC format, which was used for compression, but the authors of the latter did not like it. As is customary in the notorious West, there was a legal battle, during which Katz showed himself to be a nice guy. You can even watch the documentary “Compression”, which describes the confrontation.

So you can't just do it good compression algorithm. We also need to promote all this in a scandal.

Although, I won’t act like a fool. A great contribution to IT, to our reality. It's a shame Phil didn't get enough fame to not drown everything in alcohol. Although, maybe it was better for him this way. He passed away in 2000 (37 years old). May you rest in peace, friend!

I would put the second format in my personal “top” RAR. Not because I see it often, but because it sticks in my mind. Every time I go and put unrar.

For Ubuntu/Debian/Mint and others with apt it is:

$ sudo apt install unrar

On FreeBSD it looks like:

% sudo pkg install unrar

And for MacOS:

$ brew install unrar

Or you can go to the App Store and download The Unarchiver

It also supports formats such as ZIP, 7z, LHA, LZH, Tar, gzip, bzip2, StuffIt, StuffIt X, DiskDoubler, Compact Pro, PackIt, cpio, XAR, RPM, LZMA, XZ, Z, CAB, MSI, NSIS, ALZip, ARJ, Ace, Zoo, ADF, DMS, LZX, PowerPacker, NSA, SAR, NDS, Split files... Well, that's true, by the way.

WinRAR has builds for both Linux and Bisti, MacOS is also included - so if you are used to it/more comfortable, it is also possible. And no wonder - it has existed since 1993.

Although rar is the development of our compatriot (born in the USSR), and at the same time he is a stern Chelyabinsk programmer... But I won’t “sink for” this moment - still, let’s be citizens of the world! But he is also the creator of FAR... Evgeniy Roshal - meet me!

In short, everything is great, but the rarchik is proprietary. He presses well, just like his creator (at least his brother). Therefore, it is not available “out of the box” on various systems, but Windows users are already very hooked on this format - you will have to see it from time to time.

In honorable 3rd place is family tar-archives. tar is the archiver. It does not compress, but archives file by file. Creates an archive! I don’t know how to point out the difference even more strongly... In general, let’s imagine an archivist. He stacks the documents one next to the other so that he ends up with a cabinet containing all the information on a certain topic. The closet is more than just a collection of files. Both in terms of its significance and in terms of its place. So, tar is an archivist. It will make an even larger file that contains a selection of other files.

Here we are talking about the algorithm, and not about the sectors of the hard drive (I know, I’m a bore, you already wanted to write about this... but I’m also a bore ;-)).

And now we can compress this file. I don’t know about you, but to me this seems like a perfect illustration of one of the Unix principles:

Write programs that do one thing and do it well.

So it is here! Okay, those who understand will understand, those who do not understand will forgive...

And now you can compress it using any universal compression algorithm (there are also specialized ones for a specific data type)!

And here we already have support for about 180 formats... Not everything is out of the box, of course. The most common:

The most common option is to create a compressed tar archive

tar -czf file.tar.gz source.c source.h

Unpack - accordingly:

tar -xzf file.tar.gz

Create/Extract - everything is logical! And this is one of the most common formats for distributing “packages” in Unix. The same slack (thanks to the great Patrick) uses it to download and install packages. Straight to the root, straight to the “soul”!

In general, use tar, listen to mom!

A whole history, infrastructure, eras, people's destinies... And only 3 types of archives.

Well, for those who wanted to unzip some tricky archive, but got stuck on this article, here is the list:

gz (gzip) file, unpack it with the command:

Same with BZ2- unzip using:

bunzip2 file.bz2

Files may also be found XZ. Unzip with the command

archive

xz --decompress file.xz

XZ can unzip files and LZMA format:

xz --format=lzma --decompress file.lz # for .lz files

For 7Z-files we use:

You need to install p7zip before this (sudo apt-get install p7zip).

Perhaps you received the file without an extension or with an incorrect one, then use the file command to find out the file format:

file file.unknown

For example:

$ file server.jjj server.jjj: Zip archive data, at least v2.0 to extract

Once you know the format, you can always go to Google and find out how to unpack it. Or contact the documentation/author and write an unpacker yourself.

I’m sure I missed over 100 more formats that “everyone uses.” Write and I’ll add it!

Many probably already know about the compression/decompression utility xz. But they don’t know even more. That's why I wrote this introductory topic.

Xz is a data compression format, along with gzip, bzip2, included in GNU applications.
Uses the LZMA algorithm, the same as in 7z, which means that it is possible to compress many types of data, such as text, binary data that has not yet been compressed, more strongly than the standard ones mentioned above.
xz is used in the new rpm 4.7.2 to compress .cpio archives in rpm packages (used since Fedora 12).
ArchLinux generally uses .tar.xz as a package.
GNU tar now has the -J --lzma option, which performs the same role as -z for gzip, -j for bzip2

Pros:
High compression ratio

Minuses:
high resource consumption:
cpu time (and actual compression time)
memory (configurable, but still more than gzip, bzip2).
In particular, xz at --best aka -9 consumes up to 700MB! with compression and 90MB with decompression

Features:
Large memory consumption is limited slightly by pre-computing available resources.
integration into GNU tar
working with streams
optional: progressbar via --verbose

I don’t want to clutter up the introductory topic too much with graphs and other things, but I can’t do without this:
I did a trivial run of gzip, bzip2, xz to see the compression ratio and time consumption. WinRar will also take part as a guest (albeit intoxicated, under wine, but still showed excellent results)

We get 4 squares:
Bottom left - slow and weak: gzip and winrar fastest.
Top left: winning compression/time ratio: bzip2, xz performs slightly better at compression levels 1 and 2, and
Top right: real pressing mechanism: long but very compressive xz
In the lower right: there is no one, and who needs a long-running and weakly compressing archiver?

But in general, the coordinate grid is not well chosen: how do we estimate time? categories! for example, quickly - 10-20 seconds, average from half a minute to a minute, more than 2 minutes - this is a long time.
so the logarithmic scale is clearer here:

And if we evaluate them as stream compression, on my Core2Duo E6750 @ 2.66GHz,
then this is the graph:


those. Using the gzip -1 or gzip -4 conveyor as a compressor, you can drive up to 25 MB/sec of uncompressed data on a 100 Mbit network. (I checked it several times - gzip -4 for some reason gives more profit than -3 or -5)
cat /some/data | gzip -1c | ssh user@somehost -c "gzip -dc > /some/data"
xz can be used in this only on channels<8мбит,

The Obvious Conclusion (With assistance from K.O.)
xz- due to resource consumption, it occupies the niche of compressor archivers, where the compression ratio can play a big role, and there is enough computing and time resources. those. various kinds of backups/archives, distributions (rpm, tar.xz in archlinux). Or data that is very easily compressed: logs, tables with text-digital data csv, tsv, which are not supposed to be changed.

P.S. No matter how happy I am for xz, the reasonableness of the efforts spent WinRar Wins.