How to Install 7-Zip on Ubuntu 24.04, 22.04 or 20.04

This guide will demonstrate how to install 7-Zip on Ubuntu 24.04, 22.04 or 20.04 LTS Linux releases utilizing the command-line terminal.

7-Zip stands out as a powerful file archiver, renowned for its high compression ratio and versatility across various operating systems, including Linux. It supports multiple compression formats, making it an indispensable tool for users looking to manage their files efficiently. With its open-source nature, 7-Zip offers a cost-effective solution for both personal and professional use.

Key features include:

  • High compression ratio in 7z format with LZMA and LZMA2 compression
  • Support for multiple formats, including ZIP, TAR, RAR, and more
  • Strong AES-256 encryption in 7z and ZIP formats for secure file handling
  • Ability to self-extract for 7z format, enhancing user convenience
  • Integration with the Windows Shell for easy access and management
  • Powerful file manager and command-line version for advanced users
  • Localization for 87 languages, making it accessible worldwide
  • Plugin for FAR Manager, further extending its capabilities

7-Zip’s functionality goes beyond mere file compression, offering features tailored for efficient file management and security. Whether you’re looking to free up storage space, secure sensitive information, or manage a wide range of file types, 7-Zip provides the tools you need in a straightforward, user-friendly package.

Now, let’s dive into the technical aspects of getting 7-Zip up and running on your Ubuntu system, ensuring you can easily leverage these powerful features.

Install 7-Zip on Ubuntu via Source Binary

By default, 7-Zip is not included in Ubuntu’s repository; another foss community exists, but the differences are considerable. We will achieve this in this guide for the traditional 7-Zip installation by downloading the 7-Zip binary.

Update Ubuntu Before 7-Zip Installation

First, to ensure you only have the source version installed, remove the free foss version p7zip-full from your Ubuntu system:

sudo apt remove p7zip-full

Download 7-Zip Binary

Visit the official 7-Zip website and select the appropriate version and architecture of the 7-Zip binary that is compatible with your system. Save the file to your computer.

For this guide, we will demonstrate using the latest version of 7-Zip, version 23.01 (2023-06-20), and the 64-bit Linux x86-64 architecture.

7-Zip download page for Ubuntu 24.04, 22.04, 20.04 LTS shown in a screenshot.
Screenshot of the 7-Zip archive download page, compatible with Ubuntu 24.04, 22.04, 20.04.

Download 7-Zip using the wget command below:

wget https://www.7-zip.org/a/7z2301-linux-x64.tar.xz

Note: The command above is an example. The version and architecture of 7-Zip you download may vary depending on your system’s specifications. Different variants of 7-Zip are available for different architectures.

Extract the 7-Zip Archive

First, make a new folder:

mkdir 7zip

Extract the archive using the following command:

tar xf 7z2301-linux-x64.tar.xz -C 7zip

The above command extracts the contents from the downloaded 7-Zip archive into the dedicated folder, which we will move later so you have better access to 7zz commands.

Run 7-Zip Binary

Now, navigate to the directory you made and extract 7-Zip too:

cd 7-zip

You can now run 7-Zip on Linux using the following command:

./7zz

When using 7-Zip from a different working directory, you must provide the full path to the binary. You can add the binary to the

Make 7-Zip Accessible System-Wide

Move the 7-Zip binary to the /usr/local/bin directory using the following command:

sudo mv ~/7zip /usr/local/bin

By adding the binary to the /usr/local/bin directory, you can now access 7-Zip from any location on your filesystem by simply using the 7zz command.

Example of 7-Zip running on Ubuntu system versions 24.04, 22.04, 20.04.
Demonstrating 7-Zip successfully operating on Ubuntu versions 24.04, 22.04, and 20.04.

Basic 7-Zip Commands with Ubuntu

This section will cover some common 7-Zip commands that you may find helpful when working with archives. These commands will help you manage your files and perform various operations such as compressing, decompressing, and listing archive contents.

Create an Archive with 7-Zip

To create a new archive, you can use the following command structure:

./7zz a <archive_name> <file_or_directory>

For example, to create a 7z archive named example.7z containing a file called file.txt, you would use the following command:

./7zz a example.7z file.txt

This command creates an archive named example.7z and adds file.txt to it. You can replace file.txt with a directory to archive an entire directory.

Extract an Archive with 7-Zip

To extract the contents of an archive, you can use the following command structure:

./7zz x <archive_name>

For example, to extract the contents of an archive named example.7z, use the following command:

./7zz x example.7z

This command extracts the contents of example.7z to the current directory.

List Archive Contents with 7-Zip

If you want to view the contents of an archive without extracting it, you can use the following command structure:

./7zz l <archive_name>

For example, to list the contents of an archive named example.7z, use the following command:

./7zz l example.7z

This command displays the files and directories contained within example.7z without extracting them.

Update an Existing Archive with 7-Zip

To update an existing archive with new or modified files, you can use the following command structure:

./7zz u <archive_name> <file_or_directory>

For example, if you have an existing archive named example.7z and you want to update it with a modified file.txt, use the following command:

./7zz u example.7z file.txt

This command updates the example.7z archive with the latest version of file.txt.

Test Archive Integrity with 7-Zip

To check the integrity of an archive and ensure there are no errors or corruption, use the following command structure:

./7zz t <archive_name>

For example, to test the integrity of an archive named example.7z, use the following command:

./7zz t example.7z

This command verifies the integrity of example.7z and reports any issues detected.

Closing Thoughts

In this guide, we walked through the steps to install 7-Zip on Ubuntu versions 24.04, 22.04, and 20.04 LTS, showcasing how straightforward it is to set up this powerful archiving tool using the command-line terminal. Remember, 7-Zip is your go-to for managing a wide array of file formats with high compression ratios and robust encryption. For anyone dealing with large files or needing secure file management, I highly recommend giving 7-Zip a try on your Ubuntu system. It’s a simple yet effective tool that can greatly impact your daily computing tasks. Happy archiving!

Leave a Comment


Your Mastodon Instance
Share to...