How To Install 7-Zip on Ubuntu 22.04 | Easy File Archiver
In this comprehensive guide, brought to you by Orcacore, we’ll walk you through How To Install 7-Zip on Ubuntu 22.04. 7-Zip is a powerful and versatile file archiver renowned for its high compression ratio. The best part? You can use 7-Zip on any computer, even within commercial organizations, without needing to register or pay a single penny. It’s a truly free and accessible tool.
7-Zip boasts compatibility with a wide range of Windows operating systems, including Windows 7, Vista, XP, 2008, 2003, 2000, NT, ME, and 98. Furthermore, a command-line version has been expertly ported to Linux/Unix systems, extending its utility across different platforms.
The majority of 7-Zip’s source code is licensed under the GNU LGPL, promoting open-source principles and collaboration. However, the unRAR code operates under a mixed license, incorporating both GNU LGPL terms and specific unRAR restrictions.
Before we dive into the installation process, ensure you have the necessary prerequisites. You’ll need to log in to your Ubuntu 22.04 server as a non-root user with sudo privileges. If you haven’t already configured this, you can refer to our guide on the Initial Server Setup with Ubuntu 22.04 available on the Orcacore website.
1. Installing 7-Zip with APT Command
By default, 7-Zip is conveniently available within the standard Ubuntu repository. Let’s begin by updating and upgrading your local package index to ensure you have the latest information. Execute the following command:
sudo apt update && sudo apt upgrade -y
This command first updates the list of available packages and their versions, then upgrades any outdated packages already installed on your system. The -y
flag automatically answers "yes" to any prompts, streamlining the process.
Now, to install 7-Zip itself, use the following command:
sudo apt install p7zip-full -y
This command instructs the apt
package manager to install the p7zip-full
package, which provides the complete 7-Zip functionality, including support for creating and extracting 7z archives. Again, the -y
flag automatically confirms the installation.
That’s all there is to it! With this single command, you’ve successfully installed 7-Zip on your Ubuntu 22.04 server.
2. How To Use 7-Zip on Ubuntu 22.04?
Now that you have How To Install 7-Zip on Ubuntu 22.04, let’s explore how to use it. The general syntax for 7-Zip commands follows this structure:
7z <command> [<switches>...] <archive_name> [<file_names>...] [<@listfiles...>]
To discover the available commands and switches for 7-Zip, simply run the following command in your terminal:
7z -h
This will display a comprehensive help message, outlining the various options and their functionalities.
Below are the screenshots of the output.


Let’s examine some practical examples of how to utilize 7-Zip in Ubuntu 22.04.
To add files to an archive, you can use the 7z a
command. For example:
7z a {file-name}.7z {file-name}.txt
In this command, a
signifies the "add" command, {file-name}.7z
represents the name you want to give to the archive, and {file-name}.txt
is the file you want to add to the archive.
To extract or open an archive in the current directory, you can employ the 7z e
command. For instance:
7z e {file-name}.7z
Here, e
indicates the "extract" command, and {file-name}.7z
is the name of the archive you wish to extract. This command extracts all files directly into the current directory.
Alternatively, you can use the 7z x
command to extract the archive while preserving the original directory structure. For example:
7z x {file-name}.7z
The x
command extracts the archive with full paths, recreating the directory structure within the archive in the current directory.
Finally, to list all the contents within an archive, you can use the 7z l
command:
7z l {file-name}.7z
The l
command displays a list of all files and directories contained within the specified archive.
Conclusion
At this point, you have successfully learned How To Install 7-Zip on Ubuntu 22.04 and how to perform basic operations with it. Installing 7zip on Ubuntu 22.04 is a straightforward process, thanks to the p7zip-full
package. With a single command, sudo apt install p7zip-full
, you can enable comprehensive support for creating and extracting 7z archives. This ensures efficient file compression and broad compatibility with various archive formats.
We hope you found this guide helpful. Please consider subscribing to us on Facebook, Instagram, and YouTube for more tutorials and insights.
You may also find these articles interesting:
Installing FastAPI with MongoDB on Ubuntu 24.04
Install Podman on Ubuntu 24.04
Install PyCharm on Ubuntu Linux
FAQs
How do I check if 7-Zip is installed?
You can verify it by checking its version: 7z --version
What is the difference between p7zip and p7zip-full?
p7zip: A minimal package with basic functionality.
p7zip-full: Includes full support for creating and extracting 7z archives.
Can I extract other archive formats with 7-Zip?
Yes, 7-Zip supports formats like ZIP, TAR, GZIP, BZIP2, and more.
Is 7-Zip available with a GUI on Ubuntu?
Yes, you can install p7zip-full with file-roller to use a graphical interface.
Alternative Installation Methods for 7-Zip on Ubuntu 22.04
While the apt
package manager provides a convenient way to install 7-Zip, here are two alternative methods you can use, offering different levels of control and flexibility:
1. Using Snap Package Manager
Snap is a package management system developed by Canonical, the company behind Ubuntu. It allows you to install applications in a sandboxed environment, ensuring better security and isolation.
To install 7-Zip using Snap, first, ensure that Snap is installed on your system. Ubuntu 22.04 usually comes with Snap pre-installed. If not, you can install it with:
sudo apt update
sudo apt install snapd
Then, install 7-Zip using the following command:
sudo snap install p7zip-desktop
This installs the desktop version of 7-Zip, which includes a graphical user interface (GUI) alongside the command-line tool. This can be useful for users who prefer a visual way to manage archives.
Explanation:
snap install
: This command tells the Snap package manager to install a package.p7zip-desktop
: This is the name of the 7-Zip package available on the Snap store. The-desktop
suffix indicates that it includes a GUI.
After installation, you can launch 7-Zip from your application menu or use the command-line tool as described earlier. Note that Snap packages are automatically updated in the background, ensuring you always have the latest version.
2. Compiling from Source
For advanced users who require maximum control over the installation process or need specific customizations, compiling 7-Zip from source is an option. This method involves downloading the source code, configuring the build process, and compiling the application manually.
First, download the source code from the official 7-Zip website or a trusted mirror. Extract the archive to a directory of your choice. Then, navigate to the extracted directory in your terminal.
wget https://www.7-zip.org/a/7z2301-src.tar.xz # Replace with the latest version
tar -xf 7z2301-src.tar.xz
cd 7z2301
Next, compile the source code using the make
command. You might need to install some development tools first, such as gcc
, g++
, and make
.
sudo apt install build-essential
make all
This will compile the 7-Zip command-line tool. To install it system-wide, you can use the make install
command, which usually requires root privileges.
sudo make install
Explanation:
wget
: Downloads the source code archive from the specified URL.tar -xf
: Extracts the contents of the archive.cd
: Changes the current directory to the extracted source code directory.sudo apt install build-essential
: Installs essential development tools required for compiling software.make all
: Compiles the source code using theMakefile
provided.sudo make install
: Installs the compiled binaries to system directories, making them accessible from anywhere.
Compiling from source gives you the most control over the build process, allowing you to customize compiler options, enable or disable specific features, and optimize the application for your specific hardware. However, it requires more technical expertise and can be more time-consuming than using a package manager. This is how to install How To Install 7-Zip on Ubuntu 22.04.