How to unzip file on Ubuntu Linux
When downloading files from the Internet you will often get an archive. The purpose of an archive among many is to reduce download size, reduce the number of files being downloaded to just one, provide a basic integrity check on the subject files, and sometimes provide additional security with the use of passwords. There are many archive types most commonly used of them are .zip, .rar. .7z, .tar.gz. Today we are going to speak about .zip archives. On Windows, there exist GUI archivers like WinZip, 7zip, or WinRAR, which are able to deal with most of the common archive types. Ubuntu Linux has a built-in Archive Manager that can be invoked by double-clicking on the .zip file in a GUI.
But what can you do when you downloaded a zip file on Ubuntu Linux and have just a bare console? This can happen when you have installed Ubuntu Server or working from a Terminal program.
So, first of all, you need to install the unzip package. To do so, type in a terminal:
sudo apt-get install unzip
You may be requested an admin password and need to grant the Ubuntu package manager, called apt, to occupy additional disk space with programs. Enter the password and answer 'yes' when needed. After all the packets have been installed, type in a terminal:
unzip archive.zip
Will extract the archive file.zip residing in the current directory extracting its contents also to the current directory. The archive can contain any type of data: software binaries, images, web pages, etc.
If you want to extract the zip file to another folder, you will need to use the -d key followed by the directory path. Type:
unzip file.zip -d destination_folder
for example:
unzip mysite.zip -d /var/www
will extract the contents of the archive mysite.zip to the folder /var/www. The directory path can be full or relative.
Sources: