p7zip

From Gentoo Wiki
(Redirected from 7za)
Jump to:navigation Jump to:search

Resources

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

kde Add support for software made by KDE, a free software community
natspec Use dev-libs/libnatspec to correctly decode non-ascii file names archived in Windows.
pch Enable precompiled header support for faster compilation at the expense of disk space and memory
rar Enable support for non-free rar decoder
static !!do not set this during bootstrap!! Causes binaries to be statically linked instead of dynamically
wxwidgets Add support for wxWidgets/wxGTK GUI toolkit

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