7-Zip and p7Zip belong to a family of file compression utilities that are among the best available for Linux/Unix. So you would think that the development communities would offer to Linux users what is available in similar compression apps on the Windows and Mac platforms. Think again!
It’s unfortunate that such a powerful tool lacks an easy interface. What makes 7-Zip and p7Zip superior to other compression utilities is the far greater compression ratios they provide. The 7z (the native format for 7-Zip files) compression algorithm produces results that are 30 to 50 percent better than standard zip compression.
But the Linux app lacks any true graphical user interface or GUI as a front end.
That leaves 7-Zip and p7Zip technology out of reach for many Linux users. The command-line-only interface is too complex for typical Linux users to master. This is especially true for Linux newcomers familiar with easy-to-use options on Windows and Mac systems.
But despite the missing GUI, Linux users looking to try the higher file-packing ratios of 7-Zip and P7Zip have two options to help them avoid the starkness of issuing terminal commands in a black void. But both of these options underscore the difficulty of using 7-Zip and p7Zip in Linux.
Not for the Choosy
First of all, not every computer user needs a compression utility. Greater Internet bandwidth and more external options for storing large files eliminate the need to crunch files into compressed formats.
Even if you do need a compression tool to save a large set of files into one wrapped-up package, easier solutions exist in Linux. For instance, nearly every Linux distro comes with a default file compression utility that has some semblance of a GUI.
One of the more popular is the File Archiver app called File Roller on the GNOME desktop. It also works with newer GNOME-based shells such as Cinnamon. But these alternatives provide much smaller compression ratios compared to the output from the 7-Zip family.
Family History
7-Zip is designed to handle a large collection of compression formats. The default format is .7z. This format is related to the older LZ77 compression algorithm. The compression algorithm built into it is LZMA, or Lemple-Ziv-Markov, algorithm.
The application in its Linux form is related to another command-line client package called “p7zip.” This second version provides two executables, 7z and 7za. Both branches use the same syntax and options.
P7zip is ported from 7-Zip. 7-Zip is available for a variety of platforms, some offering GUIs. But not in Linux. P7zip is the command-line version of 7-Zip strictly for Unix/Linux users. It was created by a different developer. Both use the new 7z format.
With 7-Zip installed on your system, a plugin adds it to the library of file-compression options available in File Roller. This arrangement at least makes using 7-Zip a bit more convenient.
Starting Point
The 7-Zip and p7Zip Linux packages are readily available in most distros’ package management systems. So installing either one is much easier than downloading a compressed file and manually installing the files.
But without a GUI, there is no desktop menu integration. So you will not find any listing for either app in your desktop menus. Using these two apps is strictly by fingertip interface.
Taking Command
I do not like issuing cryptic commands in a terminal window. So even clumsy workarounds are a better option for me. Unless you have pressing needs for the tighter compression results 7-Zip and p7Zip deliver, using either one is less inviting. The 7-Zip commands are sometimes confusing.
Typical for Linux applications, especially those with no GUI, the lack of documentation adds to the user dilemma. But if you put some effort into using the -h command after the app name and scouring the Internet for command instructions, you can get some impressive results.
I found that extracting files from a 7Z archive is considerably easier than “zipping” files into an archive. If for no other reason, the command-line structure requires fewer options.
For example, uncompress an archive using this format: 7z x myfile.7z . The e function extracts all files to the current working directory. The x function preserves their paths.
Alternative Access
I found an unusual solution on the Internet that introduced me to the advantages of the 7-Zip app. Go here to use a form to generate the 7z commands. Lonnie Lee Best created a Simple 7-Zip Command Generator that makes learning the CLI (command line instruction) process a lot less intimidating.
Use the form to create the needed 7z commands. Then copy them directly into your terminal at the command prompt. His form does not include all of the range of commands available in 7-Zip. But he provides enough to give you a good head start.
The form asks you basic questions about your file compression task. You enter the information. The needed commands are generated at the bottom of the form.
For example, you tell the form generator where the folder or file is that you want to archive. (example: /home/user/Desktop/FolderName)
Next, enter into the form the folder you want the output file(s) to be placed. (example: /home/user/Desktop)
Third, tell what you like to name the output file(s) and what level of compression you want and whether to divide the output into multiple volumes.
Finally, when you have answered all the questions on the form, click the button to generate your command. Remember to copy and paste the results into an open terminal window to perform the file compression.
Mind Your Ps and Qs
I did find a partial front end for 7-Zip called “Q7Z.” It is not a full GUI solution for the Linux 7-Zip app. But it does help automate the process, especially for creating compressed 7z files. But the setup may be just as demanding.
Get the Autopackage file here. Get ready to roll up your sleeves. A few detailed setup procedures are needed before you can use this workaround. And yes, you will have to open a terminal window to do these steps after the download is finished.
- Step one: Change to the directory holding the Autopackage File.
- Step Two: Give the file you downloaded executable permissions. Use this command to do this:
chmod u+x q7z-XXX-package (Replace the XXX with the actual release number listed in the downloaded file’s name)
- Step Three: Enter this command:
sudo ./q7z-XXX-package (Again, replace the XXX with the release number as you did in Step Two)
Finishing Up
If all goes as instructed, you will see activity fill the terminal window. The installer will ask you a series of questions that seek your permission to get and install several components and missing dependencies.
Once that process completes, the Autopackage installer completes the procedure by running the full install process.
When all activity in the terminal window ends, your work is done. Now you can actually use Q7Z to control the 7-Zip file compression app. Start it with this command in the terminal window: Q7Z.pyw.
Bottom Line
The Command Line Interface for 7-Zip and p7Zip make these file compression apps less than appealing to use. But if you want the maximum file-crunching results they provide, you will have to learn to deal with the inconvenience that comes with not having a bona fide GUI. The online Command Generator or the Q7Z partial front end offer some relief.
If you work often with archiving files, either of these two CLI apps can give you excellent results. The more you use them, the easier the command line instructions will become.
I registered this account just to say:
Wow, this is the biggest piece of crap I’ve ever read!
The author is too lazy to learn about 7zip and the CLI. For someone who writes articles, he sure does not know how to read others. IF he did so, he should have read in his reference (wikipedia) that CLI means Command Line INTERFACE, not Command Line Instruction.
Furthermore 7zip does not store file permissions and/or owner/group information. Do NOT use 7z for backup purposes. The workaround aka Tar->7zip does not work EITHER. The only workaround I can think about is getting all permissions + owner/group data of your system into a file, extract your 7zipped system and set permissions + owner/group via ch{mod,own,grp}.
DELETE THIS ARTICLE, IT IS A SLAP INTO EVERY LINUX FAN’S FACE. Never let this man post an article again.
I agree with the commenter who said this article should be deleted. And to the commenter who said it "borders on disinformation", you’re almost right. It is clear and unapologetic disinformation. Anyone new to Linux who reads the article but not the comments would believe that tired old stereotype about Linux requiring the commandline for everything. Join us in the new millenium, people! Almost NOTHING on Linux REQUIRES the commandline anymore. It’s only still there because for SOME activities it’s still FAR more efficient and simple than wading through countless mouse clicks in a GUI. For you newbs who equate GUI with simplicity, you’re entirely welcome to do everything you want to with your mouse. Linux is NOT stopping you. Only your unwillingness to accept REALITY is stopping you. The reality is that computers and operating systems (including Linux) have CHANGED in the past 30 years. SURPRISE!
Not well researched. KDE includes full GUI support for 7-zip in Dolphin (creation and extraction).
Read the p7zip man page and I quote:
"DO NOT USE the 7-zip format for backup purpose on Linux/Unix because :
– 7-zip does not store the owner/group of the file.
On Linux/Unix, in order to backup directories you must use tar"
7-zip on Linux is only for compatibility with the popular formats of other OS’s and as already mentioned is well-supported by all the major archive GUI’s. True Linux users don’t want a different, inconsistent GUI for every format under the sun; we want software organized neatly by its purpose and if that purpose is archives we want one GUI to rule over all the various formats – and that’s exactly what we already have.
If you are doing real Linux backups and want 7zip’s impressive compression you should ALWAYS use the *.tar.lzma format, NEVER 7zip.
Aww beat me to it!
Hahaha, this article should be deleted! This just shows how ignorant the writer is about Linux. Just that screen shot of him using the terminal is enough to make me laugh at his newb-ness!
Okay Jack, in Linux, a great many of our programs are actually controlled through cli behind the scenes. And we just get a nice GUI program that actually uses these cli programs inside it. We like choice in Linux so we can easily use any GUI we want.
Not all programs are this way, but I’ve seen a lot. Good examples are media programs like ffmpeg.
You are so uninformed that this article is borderline disinformation.
I use KDE 3.5, the good old one, and I have more GUI than I can handle to deal with 7z archives. To extract, I just right-click and select "Extract…". To compress, I just select my folders and files, right-click and select "Compress…". 7z has been available for years in the possible archive formats.
If I want to go the complicate way, I can explicitly open the 7z archive with Ark and extract from there. To create a 7z archive from Ark is as simple: I drag and drop from Konqueror, the file browser and save as "something.7z". That’s all.
The only thing that is missing is that I cannot explore 7z archives as if they were folders like I can do with pretty much all the other archive formats. (It is still not available in KDE 4.x either, at least not in the version I have.)
The CLI tool is for Bash maniacs… or, more seriously, for specialized uses where it is convenient not to have any GUI. It is not even installed on my system and 7z is obviously well supported.
I cannot say much about the Ubuntu i.e. Gnome side of the things. My exposure to Gnome is mostly limited to GiMP. I shall not make any supposition except maybe that you must be using some desktop without all the bells and whistles of KDE.