Install and use 7 ZIP on Ubuntu Linux

In addition to the 7z format, the 7 ZIP tool also supports compression of other file formats such as XZ, BZIP2, GZIP, TAR, ZIP and WIM. Besides, users can use the tool to decompress files such as AR, ARJ, CAB, CHM, CPIO, CramFS, DMG, EXT, FAT, GPT, HFS, IHEX, ISO, LZH, LZMA, MBR, MSI , NSIS, NTFS, QCOW2, RAR, RPM, SquashFS, UDF, UEFI, VDI, VHD, VMDK, WIM, XAR and Z.

Continue reading TipsMake's article below to learn how to install and use 7 ZIP on Ubuntu Linux.

1. Install 7 ZIP on Ubuntu Linux

To download and install the p7zip tool on Ubuntu Linux, use the command below:

sudo apt-get install p7zip-full p7zip-rar

2. Use 7 ZIP on Ubuntu Linux

The p7zip package installs a command-line utility called 7z. Below is the syntax:

7z [adeltux] [-] [SWITCH] .

To make it easier to imagine, below TipsMake will explain how to use 7 ZIP on Ubuntu Linux.

To get started, let's first learn how to create a .7z archive using this command. Suppose you have a folder named files containing 4 files in it.

Install and use 7 ZIP on Ubuntu Linux Picture 1

The task is to package these 4 files in a .7z file. To do this, enter your files directory into the command line and execute the command below:

$7z a files.7z *

The screenshot below shows how the command is working:

Install and use 7 ZIP on Ubuntu Linux Picture 2

After the above command runs successfully, a file named files.7z will be created in your current working directory.

Install and use 7 ZIP on Ubuntu Linux Picture 3

Suppose if you accidentally/intentionally delete 4 files in the current files folder.

Install and use 7 ZIP on Ubuntu Linux Picture 4

And you want to get these files back by decompressing the .7z compressed file you just created. To do this, we use the command line option " e " as shown in the command below:

7z e files.7z

Install and use 7 ZIP on Ubuntu Linux Picture 5

Above are the basic steps to create and decompress compressed files using the 7z tool on Ubuntu Linux.

Next suppose if you need to create a .zip file. To do this, use the command below:

7z a [zipfile-name] [files-to-be-zipped]

For example:

Install and use 7 ZIP on Ubuntu Linux Picture 6

In addition, the 7zip tool also allows users to easily access compressed files (archive files) after creation. For example, suppose you have just created a compressed file and discover that you need to add certain files or folders to the compressed file. Instead of deleting the old archive you just created and creating a new one, you just need to update the archive you just created with the files and folders you want to add.

For example, suppose the file folder contains a total of 5 text files and you want to add file file5 to the compressed file files.7z. To do this, use the "u" option in the 7zip command:

Install and use 7 ZIP on Ubuntu Linux Picture 7

To confirm the compressed file has been updated, just double click on the file to open it. Alternatively you can do this via the command line, using the " l " option in the 7z command:

Install and use 7 ZIP on Ubuntu Linux Picture 8

In the screenshot above, you can see that the 7z command confirms that the files.7z archive has just been updated with the new text file.

If you want to delete certain files in the compressed file created by 7z, you can do this too. In this case, we use the command line option " d ". The overall syntax of the command is as follows:

7z d [archive-name] [file-to-be-deleted]

Note that you must add the " r " switch to the command in case the file in question is in a subfolder of the archive.

Important note

Here are some important notes that you need to remember when using the 7z utility:

- Do not use 7-zip format for backup on Linux/Unix because 7-zip does not store users/groups of files.

- On Linux/Unix, to backup folders, you must use tar command:

+ To backup a directory, use the command tar cf - directory | 7za a -si directory.tar.7z

+ To restore a backup use the command: 7za x -so directory.tar.7z | tar xf -

- If you want to send files and folders (not the file owner) to other Unix / MacOS / Windows users, you can use the 7-zip format.

- The " r " option should not be used .

- Do not use directory/* because " .* " files do not match " directory/.profile ").


The above article TipsMake has just shown you how to install and use 7 ZIP on Ubuntu Linux. In addition, if you have any questions or concerns like how to extract RAR files on Linux or Unix, readers can leave their comments in the comments section below the article.

4 ★ | 1 Vote

May be interested

  • 8 ways Ubuntu changes and improves Linux8 ways Ubuntu changes and improves Linux
    ubuntu is the most prominent linux distribution in the world. ubuntu and its developer, canonical, have been plagued by a lot of fuss over the years, but the linux world is getting much better thanks to both.
  • How to install GIMP on Ubuntu 18.04How to install GIMP on Ubuntu 18.04
    currently, gimp version 2.10.18.1 has been released and is available to install on ubuntu, linux, and we all know gimp is one of the famous free, cross-platform, open source photo editing software. first, in this article, thuthuat.taimienphi.vn will guide you how to install gimp on ubuntu 18.04.
  • Instructions for installing VLC 1.1 from Git in Ubuntu LinuxInstructions for installing VLC 1.1 from Git in Ubuntu Linux
    with many improvements in version 1.1, many ubuntu users are quite eager to become the first to enjoy vlc's gadgets.
  • How to Install Ubuntu Linux Without CD (Windows)How to Install Ubuntu Linux Without CD (Windows)
    want to install ubuntu on your windows computer, but don't have a dvd or cd drive? there are a couple of different ways that you can install ubuntu on computers that don't have disc drives. the most common way is to create a bootable usb...
  • Tips and tricks after installing UbuntuTips and tricks after installing Ubuntu
    ubuntu is one of the completely free open source operating systems. this is a distribution (distro) of linux with the second highest amount of traffic after linux mint.
  • How to install GNOME on Ubuntu 20.04 LTS Focal FossaHow to install GNOME on Ubuntu 20.04 LTS Focal Fossa
    gnome, gnu network object model environment is a graphical user interface (gui) in linux and especially in the ubuntu operating system. it includes many desktop applications and its purpose is to make the linux system easy to use for non-programmers.
  • How to Install Ubuntu LinuxHow to Install Ubuntu Linux
    this wikihow teaches you how to install ubuntu linux on your windows or mac computer without erasing your current operating system. make sure that your computer can run linux. your computer must meet the following system...
  • How to install Hyper Terminal in Ubuntu 20.04How to install Hyper Terminal in Ubuntu 20.04
    hyper is an open source application supported on all three major platforms: windows, linux, and macos. in this tutorial, tipsmake.com will explain how to install hyper terminal in ubuntu system.
  • How to install Skye on UbuntuHow to install Skye on Ubuntu
    there are actually several ways to install skype on linux. this article will show you how to install skype on ubuntu using the snap package or download directly from the microsoft website.
  • How to install Solus LinuxHow to install Solus Linux
    recently, the linux community has given winged compliments to solus linux. this is understandable because this is a beautiful operating system with lots of great features. in a world where most popular linux distributions are 'derivative ubuntu', solus linux really stands out.