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.
sudo apt install unzipfor Linux distributions Ubuntu or Debian or
sudo yum install unzip zipfor versions that use of packages formats Red Hat. After the introduction click on Enter.
cd /home/user/folder, where user is the user name and folder is the folder where the archive is stored.
unzip folder, where folder is the name of the archive .zip to add optional, the utility itself will determine the format.
unzip folder.zip -d /waywhere /way — the name of the folder where to save the files.
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.
sudo apt install p7zip-full, and the owners of Red Hat and CentOS you will need to specify
sudo yum install p7zip.
cd. Here, view the object contents before unpacking, writing in the console
7z l folder.zipwhere folder.zip — the name of the archive.
7z x folder.zip.
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
xpath remains the same);
t— test archive integrity;
-p— specifies the password for the archive;
-x + a list of filesnot 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.