How To Install p7zip on Ubuntu 22.04

In this tutorial we learn how to install p7zip on Ubuntu 22.04. p7zip is 7zr file archiver with high compression ratio

Introduction

In this tutorial we learn how to install p7zip on Ubuntu 22.04.

What is p7zip

p7zip is:

p7zip is the Unix command-line port of 7-Zip, a file archiver that handles the 7z format which features very high compression ratios.

p7zip provides:

  • /usr/bin/7zr a standalone minimal version of the 7-zip tool that only handles 7z, LZMA and XZ archives. 7z compression is 30-50% better than ZIP compression.
  • /usr/bin/p7zip a gzip-like wrapper around 7zr.

p7zip can be used with popular compression interfaces (such as File Roller or Nautilus).

Another package, p7zip-full, provides 7z and 7za which support more compression formats.

There are three methods to install p7zip on Ubuntu 22.04. We can use apt-get, apt and aptitude. In the following sections we will describe each method. You can choose one of them.

Install p7zip Using apt-get

Update apt database with apt-get using the following command.

sudo apt-get update

After updating apt database, We can install p7zip using apt-get by running the following command:

sudo apt-get -y install p7zip

Install p7zip Using apt

Update apt database with apt using the following command.

sudo apt update

After updating apt database, We can install p7zip using apt by running the following command:

sudo apt -y install p7zip

Install p7zip Using aptitude

If you want to follow this method, you might need to install aptitude first since aptitude is usually not installed by default on Ubuntu. Update apt database with aptitude using the following command.

sudo aptitude update

After updating apt database, We can install p7zip using aptitude by running the following command:

sudo aptitude -y install p7zip

How To Uninstall p7zip on Ubuntu 22.04

To uninstall only the p7zip package we can use the following command:

sudo apt-get remove p7zip

Uninstall p7zip And Its Dependencies

To uninstall p7zip and its dependencies that are no longer needed by Ubuntu 22.04, we can use the command below:

sudo apt-get -y autoremove p7zip

Remove p7zip Configurations and Data

To remove p7zip configuration and data from Ubuntu 22.04 we can use the following command:

sudo apt-get -y purge p7zip

Remove p7zip configuration, data, and all of its dependencies

We can use the following command to remove p7zip configurations, data and all of its dependencies, we can use the following command:

sudo apt-get -y autoremove --purge p7zip

References

Summary

In this tutorial we learn how to install p7zip package on Ubuntu 22.04 using different package management tools: apt, apt-get and aptitude.