7zip is a wildly popular Windows program that is used to create archives. By default it uses 7z format which it claims is 30-70% better than the normal zip format. It also claims to compress to the regular zip format 2-10% more effectively than other zip compatible programs. It supports a wide variety of archive formats including (but not limited to) zip, gzip, bzip2, tar, and rar. Linux has had p7zip for a long time. However, this is the first time 7Zip developers have provided native Linux support.
Jump to Installation Instructions
p7zip vs 7Zip - What's the Difference
Linux has has p7zip for some time now. The p7zip is a port of the Windows 7zip package over to Linux/Unix. For the average user there is no difference. The p7zip package is a direct port from 7zip.
Why Bother Using 7zip if p7zip is available?
The main reason to use the new native Linux version of 7Zip is updates. The p7zip package that comes with my Fedora installation is version 16.02 from 2016. However, the newly installed 7zip version is 21.01 (alpha) which was released just a few days ago.
Details from p7zip Package
7-Zip [64] 16.02 : Copyright (c) 1999-2016 Igor Pavlov : 2016-05-21
Details from Native 7Zip Package
7-Zip (z) 21.01 alpha (x64) : Copyright (c) 1999-2021 Igor Pavlov : 2021-03-09
Install Native 7Zip on Linux Command Line
First, we need to download the tar.zx package from the 7Zip website.
wget https://www.7-zip.org/a/7z2101-linux-x64.tar.xz
Next we extract the tar archive. Here I am extracting it to /home/gbaremmi/bin/
since that directory is in my PATH.
tar xvf 7z2101-linux-x64.tar.xz -C ~/bin/
That's it, you are now ready to use 7Zip.
If you have previously has the p7zip package installed you now have two similar commands. The p7zip package provides the 7z
command. While the new native version of 7Zip provides the 7zz
command.
Using Native 7Zip (7zz) in Linux
7Zip comes with a great deal of options. This full suite of options are beyond the scope of this article. Here we will cover basic archive creation and extraction.
Creating a 7z Archive with Native Linux 7Zip (7zz)
To create a 7z archive, we will call the newly install 7zz utiltiy and pass the a
(add files to archive) command. We will then supply the name of the archive, and the files we want added.
[gbaremmi@putor ~]$ 7zz a words.7z dict-words/*
7-Zip (z) 21.01 alpha (x64) : Copyright (c) 1999-2021 Igor Pavlov : 2021-03-09
compiler: 9.3.0 GCC 9.3.0 64-bit locale=en_US.UTF-8 Utf16=on HugeFiles=on CPUs:4 Intel(R) Core(TM) i7-4600U CPU @ 2.10GHz (40651),ASM,AES
Scanning the drive:
25192 files, 6650099 bytes (6495 KiB)
Creating archive: words.7z
Add new data to archive: 25192 files, 6650099 bytes (6495 KiB)
Files read from disk: 25192
Archive size: 2861795 bytes (2795 KiB)
Everything is Ok
In the above example we are adding all the files in the dict-words
directory to the words.7z
archive.
Extracting Files from an Archive with Native Linux 7Zip (7zz)
Extracting an archive is very similar. Here we are using the e
(extract) command.
[gbaremmi@putor new-dict]$ 7zz e words.7z
7-Zip (z) 21.01 alpha (x64) : Copyright (c) 1999-2021 Igor Pavlov : 2021-03-09
compiler: 9.3.0 GCC 9.3.0 64-bit locale=en_US.UTF-8 Utf16=on HugeFiles=on CPUs:4 Intel(R) Core(TM) i7-4600U CPU @ 2.10GHz (40651),ASM,AES
Scanning the drive for archives:
1 file, 2861795 bytes (2795 KiB)
Extracting archive: words.7z
--
Path = words.7z
Type = 7z
Physical Size = 2861795
Headers Size = 186150
Method = LZMA2:23
Solid = +
Blocks = 1
Everything is Ok
Files: 25192
Size: 6650099
Compressed: 2861795
That's it! We have now installed native 7Zip and used it to create and extract our first archive.
Resources and Further Reading
Leave a Reply Cancel reply
This site uses Akismet to reduce spam. Learn how your comment data is processed.
1 Comment
Join Our Newsletter
Categories
- Bash Scripting (17)
- Basic Commands (51)
- Featured (7)
- Just for Fun (5)
- Linux Quick Tips (98)
- Linux Tutorials (65)
- Miscellaneous (15)
- Network Tools (6)
- Reviews (2)
- Security (32)
"the newly installed 7zip version is 21.01 (alpha) which was released just a few days ago." And that's a good reason to use it? An alpha, perfunctorily tested, version?