How to Install 7-zip on Ubuntu 20.04

Install 7-zip on Ubuntu 20.04

In this article, we will have explained the necessary steps to install and use the 7-zip on Ubuntu 20.04 LTS. Before continuing with this tutorial, make sure you are logged in as a user with sudo privileges. All the commands in this tutorial should be run as a non-root user.

7-Zip is open-source software available to compress and decompress files and folders into various formats. You can use this to compress and decompress files and folders in 7z, XZ, BZIP2, GZIP, TAR, ZIP, and WIM formats. It is the best alternative to Winrar software that is meant for Windows platforms.

Install 7-zip on Ubuntu 20.04

Step 1. First, before you start installing any package on your Ubuntu server, we always recommend making sure that all system packages are updated.

sudo apt update
sudo apt upgrade

Step 2. Install 7-zip archiver on the Ubuntu system.

Run the following command to download and install the p7zip tool in Ubuntu:

sudo apt install p7zip-full p7zip-rar

Check the package is properly installed or not by using 7z command:


Step 3. Using the 7-zip commands.

After executing this in your Terminal, p7zip will get installed as CLI utility 7z. The syntax of 7z is given below:

7z <command>

7Zip Commands:

  • a: Add files to archive
  • b: Benchmark
  • d: Delete files from archive
  • e: Extract files from archive (without using directory names)
  • l: List contents of the archive
  • t: Test integrity of the archive
  • u: Update files to archive
  • x: Extract files with full paths

For example, create a compressed archive for your file using the following command:

7z a [archive name] [file/directory]

For example, to decompress a 7zip file, we use the following command:

7z e [archive name]

For example, To view list the contents of an archive among other details using the following command:

7z l [archive name]

That’s all you need to do to install 7-zip on Ubuntu Focal Fossa. I hope you find this quick tip helpful. For further reading on Install 7-zip archiver, please refer to their official knowledge base. If you have questions or suggestions, feel free to leave a comment below.