How to unzip in Linux

To store programs, directories and files sometimes it is easier to archive, because they take up less space on the computer and can move freely through removable media on different computers. One of the most popular archive formats ZIP is considered. Today we would like to talk about how to work with this data type operating systems based on the Linux kernel, since the same unpacking or view the content will have to use additional utilities.

Unpack the ZIP archives in Linux

Then we will touch two free popular utilities that are managed through the console, then the user will have to enter built-in and additional commands to control all files and tools. The example today will be the Ubuntu distribution, and for owners of other assemblies, we will do the emphasis on any discrepancies.

Separately want to note, if you are interested in further installing the program from the archive, first check it in the official repositories or individual packages for your distribution, because to make such an installation much easier.

Method 1: Unzip

At least in Ubuntu Unzip is built-in utility that allows you to manage the files we need, but in other builds of Linux, this useful tool may be missing, so let’s start with installing it, then we’ll deal with interaction.

  • To begin, launch the”Terminal” by any convenient method, for example, through the menu.
  • Here, write the command sudo apt install unzip for Linux distributions Ubuntu or Debian or sudo yum install unzip zip for versions that use of packages formats Red Hat. After the introduction click on Enter.
  • Specify the password to enable root access because we use the command sudo, performing all steps as root.
  • It now remains to wait until all the files will be added to the operating system. In the case of Unzip on your computer you’ll receive a notification.
  • Next, you need to learn the location of the desired archive, if you have not done so in advance. To do this, open the storage folder object, click on it RMB and choose “Properties”.
  • Note the path of the parent folder, it will come in handy during unpacking.
  • Go back to “Terminal” and navigate to the parent folder using cd /home/user/folder, where user is the user name and folder is the folder where the archive is stored.
  • To start the extraction process enough to write unzip folder, where folder is the name of the archive .zip to add optional, the utility itself will determine the format.
  • Wait for new lines to enter. If not got any errors, then everything went well and you can navigate to the parent folder of the archive to find it already unpacked version.
  • If you want to place the unzipped files in another folder have to use an additional argument. Now you need to register unzip folder.zip -d /waywhere /way — the name of the folder where to save the files.
  • Wait for completion of processing all objects.
  • To view the contents of the archive with the command unzip-l folder.zipbeing in the parent folder. It will display all found files.
  • As for the additional arguments used in the utility Unzip, it should be noted some of the most important:

    • -u — update existing files in the directory;
    • -v — displays all available information about the object;
    • -P — set password for obtaining permission to extract the archive (in the case of encryption);
    • -n — do not overwrite existing files in-place decompression;
    • -j — ignoring the structure of the archive.

    As you can see, nothing complicated in the management utility called Unzip no, but it is not suitable to all users, so I advise to see with the second method, which will apply a more widespread solution.

    Method 2: 7z

    Multifunctional utility for 7z archives is not only to interact with the same type of files, but also supports other popular formats, including ZIP. For the operating systems on Linux also have a version of this tool, so we suggest to familiarize with it.

  • Open the console and download the latest version of 7z from the official repository by typing sudo apt install p7zip-full, and the owners of Red Hat and CentOS you will need to specify sudo yum install p7zip.
  • Confirm adding new files to the system by selecting Yes option.
  • Navigate to the folder where the archive is stored, as shown in the previous method by using cd. Here, view the object contents before unpacking, writing in the console 7z l folder.zipwhere folder.zip — the name of the archive.
  • The process of decompression to the current folder using 7z x folder.zip.
  • If some files with same name already exist there, they will offer to replace or skip. Select the option based on your preferences.
  • As with Unzip, 7z has a number of additional arguments, too, suggest to familiarize with the main of them:

    • e — extract file path (when using x path remains the same);
    • t — test archive integrity;
    • -p — specifies the password for the archive;
    • -x + a list of files not to extract specified objects;
    • -y — positive answers to all the questions during decompression.

    You have received instructions on the use of two popular utilities to decompress ZIP in Linux. Please pay special attention to the additional arguments and do not forget to apply them if necessary.

    Source: lumpics.ru

    (Visited 41 times, 1 visits today)