7-Zip is a popular open-source file archiver known for its high compression ratio and support for a wide range of file formats, including 7z, ZIP, RAR, and TAR. It’s a powerful tool for compressing and decompressing files, making it a must-have for users who frequently handle large archives. While 7-Zip is more commonly associated with Windows, it can also be installed on Ubuntu, providing the same robust features on a Linux system.
To install 7-Zip on Ubuntu 24.04, 22.04, or 20.04 via the command-line, you can download the latest 7-Zip archive directly from the official website and manually install it. This method ensures that you have the most recent version of 7-Zip with all the latest features and updates. This guide will walk you through the process of downloading and installing 7-Zip on your Ubuntu system.
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 Archive
Visit the official 7-Zip website, select the appropriate version and architecture of the 7-Zip binary compatible with your system, and 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.
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.
Basic 7-Zip Commands
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
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
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
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
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
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
By installing 7-Zip on your Ubuntu system using the latest downloadable archive, you gain access to a powerful tool for managing file compression and extraction tasks. This method ensures you have the most up-to-date version of 7-Zip, allowing you to benefit from its high compression efficiency and wide format support. Regularly checking for updates and downloading the latest version will keep your 7-Zip installation current, ensuring optimal performance on your Ubuntu system. Enjoy the versatility and power that 7-Zip brings to file management in a Linux environment.
- How to Install ModSecurity 2 with Apache on Debian 12 or 11 - Tuesday, September 17, 2024
- How to Install Remi RPM on Rocky Linux 9 or 8 - Monday, September 16, 2024
- How to Install Akregator on Ubuntu 24.04, 22.04 or 20.04 - Tuesday, September 3, 2024
Thanks