How to install 7zip in Linux
Problem: I need to get some files from the ISO image, so I want to use the 7zip program. So how should I install the 7zip software [fully installed on the Linux Version]?
7zip is an open-source archive application developed for Windows systems. It can package or unpackage files in multiple formats, in addition to supporting native documents in 7z format, it also supports formats such as XZ, GZIP, TAR, ZIP, and BZIP2. In general, 7zip is also used to extract files in RAR, DEB, RPM, and ISO formats. In addition to simple archiving, 7zip also provides support for AES-256 algorithm encryption, self-extracting, and multi-volume archiving. On POSIX-compliant systems (Linux, Unix, and BSD), native 7zip programs are transplanted and named p7zip (short for POSIX 7zip ).
The following describes how to install 7zip (or p7zip) in Linux ).
Install 7zip In Debian, Ubuntu, or Linux Mint
There are three 7zip software packages in the Debian-based release system.
- P7zip: Contains 7zr (the smallest 7zip archive tool) and can only process native 7z formats.
- P7zip-full: Contains 7z, supports 7z, LZMA2, XZ, ZIP, CAB, GZIP, BZIP2, ARJ, TAR, CPIO, RPM, ISO and DEB formats.
- P7zip-rar: contains a plug-in that can extract RAR files.
We recommend that you install the p7zip-full package (not p7zip) because it is the most complete 7zip package that supports many archive formats. In addition, if you want to process RAR files, you also need to install a p7zip-rar package to make a separate plug-in package because RAR is a proprietary format.
Decompress RAR and 7Z files in Ubuntu 12.10
- $ Sudo apt-get install p7zip-full p7zip-rar
Install 7zip in Fedora or CentOS/RHEL Systems
Two 7zip software packages are provided on the Red Hat-based release system.
- P7zip: Contains 7za commands and supports 7z, ZIP, GZIP, CAB, ARJ, BZIP2, TAR, CPIO, RPM, And DEB formats.
- P7zip-plugins: contains the 7z command, an additional plug-in that extends the 7za command (for example, supports extraction in ISO format ).
In CentOS/RHEL systems, make sure that the EPEL resource library is available before running the following command, but no additional resource library is required in the Fedora system.
- $ Sudo yum install p7zip p7zip-plugins
Note that, unlike the Debian-based Release System, the Red Hat-based release system does not provide RAR plug-ins. Therefore, you cannot use the 7z command to extract and decompress RAR files.
Use 7z to create or extract archive files
Once the 7zip software is installed, you can use the 7z command to package and unpackage all kinds of archive files. The 7z command uses different plug-ins to help process archive files in the corresponding format.
You can use the "a" option to create an archive file. It can create files in the 7z, XZ, GZIP, TAR, ZIP, and BZIP2 formats. If the specified archive file already exists, it will "APPEND" the file to the existing archive, instead of overwriting the original archive file.
- $ 7z a <archive-filename> <list-of-files>
You can use the "e" option to extract an archive file. The extracted file will be placed in the current directory. The supported formats are more than those supported during creation, the formats include 7z, XZ, GZIP, TAR, ZIP, BZIP2, LZMA2, CAB, ARJ, CPIO, RPM, ISO, and DEB.
- $ 7z e <archive-filename>
Another way to unpack is to use the "x" option. Unlike the "e" option, it uses a full path to extract archived content.
- $ 7z x <archive-filename>
To view the list of archived files, use the "l" option.
- $ 7z l <archive-filename>
To update or delete an archive file, use the "u" and "d" Options respectively.
- $ 7z u <archive-filename> <list-of-files-to-update>
- $ 7z d <archive-filename> <list-of-files-to-delete>
To test the integrity of an archive, use:
- $ 7z t <archive-filename>