How to Install 7-Zip (Command & GUI) in Ubuntu 22.04 & 24.04

Last updated: March 18, 2024 — Leave a comment

This simple tutorial shows how to install 7-Zip file archiver in Ubuntu Desktop.

7-Zip is a popular free open-source file archiver with a high compression ratio. Ubuntu Linux can get it in few different packages:

  • p7zip – a command line port of 7-Zip for POSIX systems, including Linux, when 7-Zip was Windows-only. Discontinued since 2016, but still popular and working good.
  • p7zip-desktop – fork of p7zip with a graphical interface.
  • 7zip – 7-Zip for Linux, command line version.

NOTE: If you just want to do compress and/or extract .7z files, then Ubuntu supports the feature out-of-the-box with the Nautilus file manager.

Option 1: p7zip-desktop (GUI)


For beginners who prefer a graphical user interface, p7zip-desktop is the only choice as far as I know.

It’s a fork of p7zip based on 7-Zip 16.02. It’s old, discontinued, but still working good in today’s Linux Desktop.

As the screenshot above shows you, it has almost the same user interface to the Windows version. Just browse and select files and folders (Ctrl+Click or Shift+Click to select multiple files/folders) then click “Add” button to add them to archive (or create new archive), or choose an archive and click “Extract” to decompress.

To install p7zip-desktop, either open Ubuntu Software (or App Center), then search & install it as Snap package:

or, press Ctrl+Alt+T on keyboard to open terminal, and run command instead to install it:

snap install p7zip-desktop

Once installed, search for and launch it ‘p7zip-desktop’ either from start menu or Gnome overview screen depends on your desktop environment.

Option 2: 7zip .deb package (command line)

7-Zip adds native Linux support since version 21.0, which however is command line only!

Ubuntu includes the 7zip package in system repository since Ubuntu 22.04. To install it, press Ctrl+Alt+T to open terminal and run command:

sudo apt install 7zip

For Ubuntu 23.10 & 24.04, also install the RAR plugin via sudo apt install 7zip-rar command.

After installation, just run 7zz command to print version and help. It’s a standalone console version of 7-Zip, compiled for dynamic system library linking.

The basic usage of 7zz command include:

  • Add file/directory to archive (or create a new one):
    7zz a archive_name.7z file_name
  • Add file/directory to archive, and set password with flag -p and hide structure of the archive with flag -mhe=on:
    7zz a archive_name.7z file_name -p -mhe=on
  • List the content of an archive:
    7zz l archive_name.7z
  • Extract all files from an archive to the current directory without using directory names:
    7zz e archive_name.7z

Option 3: 7zip official Linux package (command line)

As you see in the last screenshot, Ubuntu 22.04 includes 7zip version 21.07 in system repository, which is old!

For the latest version, 7zip website provides the official package via the link below:

If you don’t know your system type, either run uname -m or dpkg --print-architecture command in terminal (Ctrl+Alt+T) to tell.

After downloaded the package, open your Downloads folder, extract the tarball, then right-click on extracted folder and click “Open in Terminal“.

In the pop-up terminal window, run ls command will list file content in current directory. To install the 7zz console version, just run commands:

sudo install 7zz /usr/local/bin
sudo install 7zzs /usr/local/bin

Different to 7zz, 7zzs is the standalone console version of 7-Zip compiled with static system library linking.

When done, run either 7zz or 7zzs command to verify 7-Zip version and command options.

Option 4: p7zip

As mentioned above, p7zip is a fork of 7-Zip when it was Windows only. It’s discontinued since 2016, but still available in Ubuntu repository just for choice!

To install p7zip, open terminal (Ctrl+Alt+T) and run command:

sudo apt install p7zip-full --install-suggests

After installation, you got 3 command tools. Run either command to tell version and command options.

  • 7z uses plugins to handle archives.
  • 7za is a stand-alone executable that handles fewer archive formats than 7z.
  • 7zr light-version of 7za that only handles 7z archives.

Uninstall 7-Zip

Depends on which version you installed, uninstall the graphical tool p7zip-desktop either via Ubuntu Software (App Center) or by running command in terminal:

snap remove p7zip-deesktop

To remove p7zip and 7zip package installed from system repository, use command:

sudo apt remove --autoremove p7zip-full 7zip

And, to uninstall the package downloaded from 7zip website, use command:

sudo rm /usr/local/bin/7zz /usr/local/bin/7zzs

Twitter

I'm a freelance blogger who started using Ubuntu in 2007 and wishes to share my experiences and some useful tips with Ubuntu beginners and lovers. Please comment to let me know if the tutorial is outdated! And, notify me if you find any typo/grammar/language mistakes. English is not my native language. Contact me via [email protected] Buy me a coffee: https://ko-fi.com/ubuntuhandbook1

No Comments

Be the first to start the conversation.

Leave a Reply

Text formatting is available via select HTML.

<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong> 

*