How to Use 7-Zip in Linux - myTechMint (2024)

In this tutorial, we will see How to Use 7-Zip in Ubuntu and on Other Linux Distributions?

7-Zip is a free open source, cross-platform, powerful, and fully-featured file archiver with a high compression ratio, for Windows. It has a powerful command-line version that has been ported to Linux/POSIX systems.It has a high compression ratio in7zformat withLZMAandLZMA2 compression, supports many other archive formats such as XZ, BZIP2, GZIP, TAR, ZIP and WIM for both packing and unpacking; AR, RAR, MBR, EXT, NTFS, FAT, GPT, HFS, ISO, RPM, LZMA, UEFI, Z, and many others for extracting only.It provides strongAES-256encryption in 7z and ZIP formats, offers a compression ratio that of2-10 %for ZIP and GZIP formats (much better than those offered by PKZip and WinZip). It also comes with self-extracting capability for 7z format and it’s localized in up-to 87 languages.

The 7-Zip support is not enabled by default in most Linux distributions.

If you try to extract it, you may see this error:

Could not open this file type. There is no command installed for 7-zip archive files.

Don’t worry, you can easily install 7zip in Ubuntu or other Linux distributions. The one problem you’ll notice if you try to use theapt-get install command, you’ll see that there are no installation candidate that starts with 7zip. It’s because the 7Zip package in Linux is namedp7zip., start with letter ‘p’ instead of the expected number ‘7’. Let’s see how to install 7zip in Ubuntu and (possibly) other Linux distributions.

How to Install 7zip in Linux

Install 7zip on Debian, Ubuntu or Linux Mint

Debian-based Linux distributions comes with three software packages related to7zipand they arep7zip,p7zip-fullandp7zip-rar. It is suggested to installp7zip-fullpackage, which supports many archive formats.

sudo apt-get install p7zip-full

Install 7zip on Fedora or CentOS/RHEL

Red Hat-based Linux distributions comes with two packages related to7zipand they arep7zipandp7zip-plugins. It is suggested to install both packages.

To install these two packages, you need to enable EPEL repository on CentOS/RHEL distributions. On Fedora, no need to setup additional repository.

sudo yum install p7zip p7zip-plugins

Once the7zippackage installed, you can move further to learn some useful 7zip command examples to pack or unpack various types of archives in the following section.

The first thing you need is to install the p7zip package. You’ll find three 7zip packages in Ubuntu: p7zip, p7zip-full and p7zip-rar.

The difference between p7zip and p7zip-full is that p7zip is a lighter version providing support only for .7z while the full version provides support for more 7z compression algorithms (for audio files etc). The p7zip-rar package provides support forRAR files along with 7z.Installing p7zip-full should be sufficient in most cases but you may also install p7zip-rar for additional support for the rar file.

Use the following command to install 7zip support in Ubuntu and Debian-based distributions.

sudo apt install p7zip-full p7zip-rar

That’s good. Now you have 7zip archive support in your system.

7zip Command Examples in Linux

Create an Archive File

To create an.7zarchive file, use"a"option. The supported archive formats for creation are 7z, XZ, GZIP, TAR, ZIP and BZIP2. If the given archive file exists already, it will “add” the files to an existing archive, instead of overwriting it.

7z a archive.7z uncompressed_files

To select an archive format, use-t (format name) option, which will allow you to select the archive format such as zip, gzip, bzip2, or tar (the default is 7z):

7z a -tzip archive.zip uncompressed_files

Extract Archive File in Linux

With 7Zip installed, you can either use the GUI or the command line to extract 7zip files in Linux.

In GUI, you can extract a .7z file as you extract any other compressed file. You right-click on the file and proceed to extract it.

In the terminal, you can extract a .7z archive file using this command:

7z e archive.7z

List All files of an Archive File

To see a list of files in an archive, use"l"(list) function, which will displays the type of archive format, method used, files in the archive among other information as shown.

7z l archive.7z

Test the Integrity of an Archive file

To test the integrity of an archive file, use"t"(test) function as shown.

7z t archive.7z

Set Compression Level

To set a compression level, use the-mxoption as shown.

7z a -mx=9 -t7z archive.7z uncompressed_files

Update Existing Archive File

To update an existing archive file or remove the file(s) from an archive file, use "u"and"d"options, respectively.

7z u <archive-filename> <list-of-files-to-update>7z d <archive-filename> <list-of-files-to-delete>

For Example:

7z u mytechmint.7z new_file.txt7z d mytechmint.7z old_file.txt

Create Password Protected Archive File

To set a password to an archive file, use-p{password_here} flag as shown.

7z a -p<password_here> archive.7z uncompressed_files

For Example:

7z a -pPassW0rd mytechmint.7z mytechmint/

Other useful options available are as below:

  • a:Add files to archive
  • -p:Prompt for a password
  • -mx=9:Level of compression (9 being ultra)
  • -mhe:Encrypt file names
  • -t7z:Generate a 7z archive

Example:

7z a -p -mx=9 -mhe -t7z archive.7z www/ backup/

More options can be checked using “7z -h” or “7z –help“.

7z -h
7z --help
How to Use 7-Zip in Linux - myTechMint (2024)

References

Top Articles
Fallout: New Vegas modder wields "creative freedom" to add rideable horses to Obsidian's epic Western RPG
SpaceX rocket grounded as two key human spaceflight missions loom | CNN
Funny Roblox Id Codes 2023
Golden Abyss - Chapter 5 - Lunar_Angel
Www.paystubportal.com/7-11 Login
Joi Databas
DPhil Research - List of thesis titles
Shs Games 1V1 Lol
Evil Dead Rise Showtimes Near Massena Movieplex
Steamy Afternoon With Handsome Fernando
Which aspects are important in sales |#1 Prospection
Detroit Lions 50 50
18443168434
Newgate Honda
Zürich Stadion Letzigrund detailed interactive seating plan with seat & row numbers | Sitzplan Saalplan with Sitzplatz & Reihen Nummerierung
Grace Caroline Deepfake
978-0137606801
Nwi Arrests Lake County
Justified Official Series Trailer
London Ups Store
Committees Of Correspondence | Encyclopedia.com
Pizza Hut In Dinuba
Jinx Chapter 24: Release Date, Spoilers & Where To Read - OtakuKart
How Much You Should Be Tipping For Beauty Services - American Beauty Institute
Free Online Games on CrazyGames | Play Now!
Sizewise Stat Login
VERHUURD: Barentszstraat 12 in 'S-Gravenhage 2518 XG: Woonhuis.
Jet Ski Rental Conneaut Lake Pa
Unforeseen Drama: The Tower of Terror’s Mysterious Closure at Walt Disney World
Ups Print Store Near Me
C&T Wok Menu - Morrisville, NC Restaurant
How Taraswrld Leaks Exposed the Dark Side of TikTok Fame
University Of Michigan Paging System
Dashboard Unt
Access a Shared Resource | Computing for Arts + Sciences
Speechwire Login
Healthy Kaiserpermanente Org Sign On
Restored Republic
3473372961
Craigslist Gigs Norfolk
Moxfield Deck Builder
Senior Houses For Sale Near Me
Whitehall Preparatory And Fitness Academy Calendar
Trivago Myrtle Beach Hotels
Anya Banerjee Feet
Three V Plymouth
Thotsbook Com
Funkin' on the Heights
Vci Classified Paducah
Www Pig11 Net
Ty Glass Sentenced
Latest Posts
Article information

Author: The Hon. Margery Christiansen

Last Updated:

Views: 5725

Rating: 5 / 5 (50 voted)

Reviews: 89% of readers found this page helpful

Author information

Name: The Hon. Margery Christiansen

Birthday: 2000-07-07

Address: 5050 Breitenberg Knoll, New Robert, MI 45409

Phone: +2556892639372

Job: Investor Mining Engineer

Hobby: Sketching, Cosplaying, Glassblowing, Genealogy, Crocheting, Archery, Skateboarding

Introduction: My name is The Hon. Margery Christiansen, I am a bright, adorable, precious, inexpensive, gorgeous, comfortable, happy person who loves writing and wants to share my knowledge and understanding with you.