+4 votes
52 views
in Linux by (242k points)
reopened
Linux: unzip zip - this is how it works

1 Answer

+5 votes
by (1.6m points)
 
Best answer

Extract via the desktop environment
Unzip via the console
Unpack combined archive formats

Unpacking zip files on Linux is child's play. The right tools are preinstalled. All you have to do is apply it..

image image

Archives are very useful for bundling many files into a single file. For example, an entire folder can be downloaded with the browser. In addition, archives often use compression algorithms in order to keep the data size as small as possible, which also favors the transmission. Now, however, the question arises of how to get back to the original files. We are going to show you here how it works on your Linux operating system.

Extract via the desktop environment

In most Linux distributions, standard tools are already installed that relieve you of unpacking an archive. This makes it very easy to unpack your packed directories. Often you can just right click on the archive file and select the unzip option. The name of this option naturally depends on the operating system in question. An archive manager such as Engrampa or File Roller is often preinstalled. The operation is the same as you may be used to from Windows. Choose the option that's right for you. The unzipped files can then be easily moved to a folder of your choice and used.

image

Unzip via the console

When unpacking via the console you have to pay attention to the archive type (zip, tar, ...). If your archive file has several extensions, such as .tar.gz , then you must use the method for combined archive formats . Here we show you the commands for the most common formats using a sample file that we have named " Test ".

First, navigate to the console to the directory that contains your archive file contains .

  • For .zip files use the following command:
    unzip Test.zip
  • With .tar files you can use this command:
    tar xfv Test.tar
  • Unzip .gz files with
    gunzip Test.gz
  • .bz2 files can be extracted with this command:
    bunzip2 Test.bz2

Unpack combined archive formats

Sometimes the different formats are also combined , resulting in endings like .tar.gz or .tar.bz2 . You then simply have to unzip these files several times. For example, with .tar.bz2 you have to unpack bz2 first and then the tar:

Test.tar.gz
is extracted like this: Test.tar.bz2 is extracted like this: The commands are simply combined with one another.
gunzip Test.tar.gz
tar xfv Test.tar



bunzip2 test.tar.bz2
tar xfv test.tar


...