Useful Tips

How to create an archive in Linux Mint and how to unzip the archive?

Unlike the operating systems of the Windows family, all operations on Linux can be performed both in the terminal (command line) and in the graphical interface, and unpacking archives is no exception. Below we will talk about how to unpack various archives in Linux using only the command line.

Types of archives on Linux

In the Windows operating system, an archive is usually understood as a file that combines several other files, while these files are compressed, i.e. the total size becomes smaller. Thus, archiving in Windows implies reducing the size of files by compressing and combining them into one file.

In Linux, archiving is a slightly different process, or rather, it is divided into two. The first, combining several files into one is archiving, the second is compression (compression) of these files in order to reduce their size. This is important, since you can meet or create an archive yourself, which will not reduce the size of files, but will simply combine several files, for example, for convenient transfer of these files to another user.

You can find out that a file is an archive by its extension, here are the most common archive extensions in Linux:

  • .tar - the archive was created by the standard tar program without data compression,
  • .tar.gz - tar archive compressed with gzip,
  • .tar.bz2 - tar archive compressed with bzip2,
  • .zip - archive with compression created by the ZIP program,
  • .7z is a compressed archive created by 7Zip.

I did not specify the type .rar, since in Linux, unlike Windows, this type of archive is rarely used, and by default there is no possibility to work with rar archives in Linux. But of course we can add the ability to work with rar in Linux, later in the article I will show how this functionality is added to Linux Mint.

Creating an archive in Linux Mint

On Linux, advanced users usually use a terminal to create an archive, i.e. command line (in principle, and for many other operations), however, for novice users this method will be a little uncomfortable and not understandable at first glance. But as you know, Linux Mint is a system that is aimed at ordinary users, therefore, by default there is a standard program with a graphical interface that can work with archives, it’s called "Archive Manager". You can run this program from the Mint menu, for example, “Menu -> Accessories -> Archive Manager”.

However, in most cases it is not required to run the archive manager to create or unpack archives; this functionality is integrated into the system.

Note!As an example, the article uses the Linux Mint 19 MATE version..

An easy way to create an archive in Linux Mint

An archive in Linux Mint can be created very easily, for this you just need to right-click on a file or folder, and click “Squeeze”.

Then by default we will be asked to create an archive .tar.gz (this is the most common type of archive in Linux) But you can change the type of archive being created by specifying the type you need in the corresponding field (drop-down list), for example, ZIP, 7z or any other of the presented list. Here you can also set the name of the resulting archive and the location folder. To start the archiving process, click Create.

As a result, in my case, the Test.tar.gz archive file was created in the same folder

If you need to archive several files, then you select them all, and in the same way call up the menu and click “Squeeze”.

Creating a 7z archive using a terminal in Linux Mint

As already noted, archives in Linux can also be created using the terminal, let's create an example 7z archive using the terminal.

This type of archive is created by a utility with the same name 7z, for this we launch the terminal, for example, using the shortcut on the panel or from the Mint menu.

Then, in order to create a Test.7z archive that will include the same Test file, you need to run the following statement

In this manual, the name of the utility is first, i.e. 7z, then the a command, which says that we need to create the archive, then we indicate the name of the resulting archive, including the path where to save it. In conclusion, we indicate the file to be archived, also including the path to this file (everywhere I indicated the path to the "Documents" directory, which is located in the user folder) If all is well, then when the utility finishes its work, it will display a “Ok” message.

In order not to specify paths to directories, you can immediately go to the desired directory with the cd command. For example, in my case, the command would look like this:

And after going into the context of a specific directory, when you run the 7z utility, you can specify only file names, i.e. no paths.

As a result, the Test.7z archive was created in the folder that I indicated.

Unpacking an archive in Linux Mint

In order to unzip the archive in Linux Mint, you can use:

  • Archive Manager (Unpack functionality),
  • Context menu caused by right-clicking on the archive,
  • Linux terminal.

Now let's look at several ways to unpack archives in Linux Mint.

An easy way to unpack an archive in Linux Mint

The easiest way to unzip an archive in Linux Mint is to use the context menu functionality caused by right-clicking on the archive "Unzip here" or Unzip to, thereby the files from the archive will be extracted to the current folder or, accordingly, to the folder that you specify.

How to unzip an archive in Linux Mint using a terminal?

If you want to unpack the archive in Linux using the terminal, then the commands for unpacking will look like this

Go to the desired directory

Unpacking 7z archive with 7Zip program

As you can see, to unpack the archive, the 7z utility must be used with the x command.

How to unzip a RAR archive in Linux Mint?

In order to be able to unpack rar archives in Linux Mint, you must install the package p7zip-rar for the 7Zip application, therefore, additional programs for unpacking rar archives are not required to be installed, i.e. you only need to expand the functionality of 7Zip.

To install the p7zip-rar package, you need to run the following command in a Linux terminal (you will need to enter an administrator password).

The command to install the p7zip-rar package

After installing this package, you can unpack rar files with the 7Zip program, the archive manager in the graphical interface, and also from the context menu Unpack, i.e. just like other types of archives.

Now you know how archives are created and unpacked in the Linux Mint operating system, I hope the material was useful to you, for now!

Unpacking tar archives on Unix / Linux

You can view the archive and find out the contents:

You can also extract the specified file, suppose you need to get some_my_archive.txt:

You can specify the path to any file in any folder:

You can easily get the specified folder from your archive, suppose you need to get "my_folder":

Unpacking gz archives on Unix / Linux

To unpack, use:

You can view the archive (compressed using GZIP) and find out the contents:

You can also extract the specified file, suppose you need to get some_my_archive.txt:

You can specify the path to any file in any folder:

You can easily get the specified folder from your archive, suppose you need to get "my_folder":

Unpacking bz2 archives on Unix / Linux

To unpack, use:

You can view the archive (compressed using BZIP2) and find out the contents:

You can also extract the specified file, suppose you need to get some_my_archive.txt:

You can specify the path to any file in any folder:

You can easily get the specified folder from your archive, suppose you need to get "my_folder":

9 comments

author, you forgot to consecrate such a problem as Russian letters in the .zip archives in linux. often archives are opened empty if there is a folder with Russian letters in the archive. these folders are unpacked in the name with the squares, and inside the files are not opened later by the system. behind

9 years of using linux as a desktop, I still could not find a solution to this problem.

there is no solution. Thank non-standard encoding Windows

Extract Archives Using Shell Functions

In order not to remember which key to use when unpacking archives, you can add a function for this. Open .bashrc or .zshrc on your OS:

And at the very end, we prescribe:

Reboot the bashrc shell:

PS: If you use zsh, then to restart it. Close and open your terminal.

Usage is quite simple, for example: