p7zip is a command-line port of 7-Zip for POSIX compliant systems such as Unix, macOS, BeOS, and Amiga. Created by Igor Pavlov, the 7-Zip compression type implements the LZMA compression algorithm, which is one of the highest compression ratios currently available. Since version 4.10 it supports little and big endian machines.
The 7-zip archive format does not store standard Unix file permissions such as owner/group or extended file attributes. Those who desire to use 7-zip as a long-term backup or archiving solution should wrap files in a tar archive before compressing with 7z. Examples are provided below.
USE flags for app-arch/p7zip Port of 7-Zip archiver for Unix
||Use dev-libs/libnatspec to correctly decode non-ascii file names archived in Windows.|
||Enable precompiled header support for faster compilation at the expense of disk space and memory (>=sys-devel/gcc-3.4 only)|
||Enable support for non-free rar decoder|
||!!do not set this during bootstrap!! Causes binaries to be statically linked instead of dynamically|
p7zip can be installed by running:
emerge --ask app-arch/p7zip
There are three different ways to invoke the compression utility:
If compiled with the
wxwidgets USE flag it also provides a graphical interface via the following invocations:
Also a wrapper included is for 7za:
Extraction of files to current directory
To extract all files from an archive to the current directory without using directory names, use the following command:
7za e <archive name>
<archive name> is to be replaced with the archive's name.
To extract with full paths, use the following command:
7za x <archive name>
Extraction to a new directory
To extract into a new directory, use the following command:
7za x -o<folder name> <archive name>
<folder name> is the name of the new folder.
Preserving file attributes
When using 7-zip on Gentoo or any other operating system that should preserve Unix file permissions, tar will need to be used in conjunction with 7z to archive or extract files.
Use the following command to archive directories of files, preserving Unix file permissions:
tar cf - <directory> | 7za a -si <directory>.tar.7z
7za x -so <directory>.tar.7z | tar xf -
- Tar — an archiver tool that provides the ability to create tar archives, as well as various other kinds of manipulation.
- Zip — provides classic zip compression.