Methods of payment Abuse

Unpacking 7Z in Linux

07.07.2024, 00:01

7z archives are inferior to Zip in terms of popularity, but they are still quite popular among a certain circle of users. One of the reasons for its popularity is that it uses the efficient LZMA2 algorithm, which according to research results is 10-40% better than Deflate (Zip). Linux distributions usually do not have a pre-installed 7z archiver. In this tutorial we will look at the process of unpacking 7z Linux. We will also give examples of how to use the 7z console utility.

Briefly what 7z is

7z archives are very rarely used by developers to distribute programs. They are often used by ordinary users, mainly due to LZMA2, which guarantees a good compression ratio. At the same time there is no need to buy a license for the archiver, when the same RAR needs to be activated. To the pluses of the format can be attributed and the fact that it works with a large number of archivers on all operating systems, however, in terms of universality, it is significantly inferior to Zip. But if you are ready to put up with this disadvantage, then 7z will suit you and will be an excellent choice.

GUI unpacking

Since 7z uses LZMA2, it is supported by most archivers available on Linux. To unpack, the Extract button should be clicked. The user has the option of dragging files to a folder or to the desktop, if this feature is available in your shell.

List of archivers that support unpacking 7z:

  • File Roller (GNOME).
  • Engrampa (Mate).
  • Ark (KDE).
  • PeaZip.
  • Xarchiver.
  • p7Zip-GUI.

The rest is a matter of technique.

Unpacking process

To unpack a 7z archive in the terminal, you should first install the p7zip utility. It is also used in archivers with a graphical interface. To install in Debian/Ubuntu, run the following command:

$ sudo apt install p7zip-full

To install in Red Hat/Fedora:

$ sudo yum install p7zip p7zip-plugins

To install in Archlinux/Manjaro:

$ sudo pacman -Sy p7zip

You can use the p7zip and 7z commands in the future. The latter includes a large list of arguments. It is worth mentioning that the programs have different syntax, but a common library. To decompress with p7zip, run the command:

$ p7zip -d file_name.7z

If the archive will be encrypted, the utility itself will ask for the password without the need to add arguments But you will not be able to select the destination folder with p7zip.

The 7z command can not only decompress, but also pack files, applying many parameters.

The main arguments of the 7z command are:

  • x - unpack all files, nesting considered.
  • e - unpack all files, without nesting.
  • o - specify a directory for unpacking.
  • l - view the contents of the archive.
  • r - process catalogs using filters.
  • i - show information about supported formats and compression algorithms.

Now let's dwell on examples of using these commands. It will simply unpack the archive to the current folder:

$ 7z x file_name.7z

You can unpack only the files you need using these commands:

$ 7z l file_name.7z -r *.db

$ 7z e file_name.7z -r file_1.db

So first all the files with the extension .db were found, after extracting file_1.db next to the archive using the command e, which decompresses files without considering nesting. With this command, the archive will be extracted into a folder:

$ 7z x file_name.7z -o folder_name

The folder name is entered without a space. In this example, the folder will be created next to the archive. You can specify another folder, such as the home directory:

$ 7z x file_name.7z -o /home/user_name/

The archiver does not understand ~. If you choose to use this abbreviation, a folder named ~ will be created. Now you know how to unzip 7z linux.

So, to unzip 7z in Linux, you need to install an archiver that supports this format. Among the graphical ones, one of the best would be PeaZip. Console archivers are not so many and to work with 7z you should use p7zip, which also contains a 7z archiver.

Why does an error occur during decompression?

An error during the unpacking process of 7Z (or 7-Zip) can occur for various reasons. Here are some possible causes and how to solve them:

  1. Incorrect file format: make sure that the file you are trying to unzip is indeed a 7Z file. If it is not, it may have been corrupted or downloaded incorrectly.
  2. Corrupted file: if the 7Z file is corrupted during download or transfer, it may cause an error during decompression. Try downloading the file again or make sure it was not corrupted during the transfer process.
  3. Problems with the 7-Zip program: sometimes the 7-Zip program itself can cause decompression errors due to improper installation or other problems. Try reinstalling the program or upgrading to the latest version.
  4. Not enough disk space: make sure you have enough free space on your disk to decompress the files.
  5. Password protection: if the 7Z file is password protected, make sure you enter the correct password when unpacking.

If the problem persists after checking these aspects, it is possible that the 7Z file is actually corrupted. In this case, try to find another copy of the file or contact the source where you got the file from for support.