p7zip

From Gentoo Wiki
Jump to: navigation, search

Resources

p7zip is a command-line port of 7-Zip for POSIX compliant systems such as Unix, OS X, 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.[1]

Important
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.

Installation

USE flags

USE flags for app-arch/p7zip Port of 7-Zip archiver for Unix

pch Enable precompiled header support for faster compilation at the expense of disk space and memory (>=sys-devel/gcc-3.4 only)
rar Enable support for non-free rar decoder

Emerge

p7zip can be installed by running:

root #emerge --ask app-arch/p7zip

Usage

Invocation

There are three different ways to invoke the compression utility:

  • 7z
  • 7za
  • 7zr

If compiled with the wxwidgets USE flag it also provides a graphical interface via the following invocations:

  • 7zG
  • 7zFM

Also a wrapper included is for 7za:

  • p7zip

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:

user $7za e <archive name>

Where <archive name> is to be replaced with the archive's name.

To extract with full paths, use the following command:

user $7za x <archive name>

Extraction to a new directory

To extract into a new directory, use the following command:

user $7za x -o<folder name> <archive name>

Where <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:

user $tar cf - <directory> | 7za a -si <directory>.tar.7z

To extract:

user $7za x -so <directory>.tar.7z | tar xf -

See also

  • 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.

References