How to Compress Files/Folders to .zip, tar.xz and 7z format in Ubuntu Desktop

File compression is a way to create archives that help us in saving time, creating space and downloading and transferring software and data faster. You can use a compressed file to distribute related files on the Internet, all compressed into a single file, without any loss of data. If you need space on your system or an external storage device, you can compress files into smaller archived file(s). In this article, we will describe how you can compress single and multiple files and folders into the following formats:

  • .zip: ZIP is an archive file format for data compression without any loss. A ZIP file can be a compressed archive of one or more files and folders. A ZIP file is compatible with all operating systems. This file format allows many compression algorithms, out of which DEFLATE is most widely used. You can identify a zipped file by .zip extension. and some operating systems indicate it through a “zipped” icon.
  • .tar.xz: TAR.XZ is an archive file format for data compression without any loss. It is usually used for compressing software packages, and output streams from some applications. These archives are mostly used in Linux and Mac systems. It is not as widely used as ZIP and mostly used by IT professionals rather than students. You can identify these files by .tar.xz extension.
  • .7z: 7z is an archive file format for data compression, encryption, and preprocessing algorithms. 7 zip is available under the terms of GNU Lesser General Public License. 7z and .rar files require additional software on Windows, Mac, and Linux.

We have run the commands and procedures mentioned in this article on a Ubuntu 18.04 LTS system.

Compress a single file

In order to compress a single file through the Ubuntu UI, select the file and then click compress from the right-click menu:

Compress single file

The following Create Archive dialog will appear:

File compress dialogue

Specify a name for the archive file and then select the format you want to compress the file to. Then click the Create button and your selected file will be compressed to your desired archive format.

Compress multiple files to one folder

In order to compress multiple files into one archive folder, select the files (existing in the same directory) and then select compress from the right-click menu as follows:

Compress folder

The following Create Archive dialog will then appear:

Create Archive Dialogue

Specify a name for the archive file that will include all your selected files, and then select the format you want to compress the files to. Then click the Create button and your selected files will be compressed to your desired archive format.

Compress folders

In order to compress a single folder through the Ubuntu UI, select the folder and then click compress from the right-click menu:

Compress folder

The following Create Archive dialog will appear:

Create archive dialogue

Specify a name for the archive file and then select the format you want to compress the folder to. Then click the Create button and your selected folder will be compressed to your desired archive format.

You can also compress multiple folders into one archive folder. Select the folders (existing in the same directory) and then select compress from the right-click menu, and then specify the archive name and format through the Create Archive dialog.

In another article, we will also explain how to compress files and folders through the Ubuntu command line. Till then, you can easily use the UI to create .zip, .tar.xz and .7z archive files.