p7zip

From ArchWiki
Revision as of 21:09, 6 June 2019 by SlavMetal (talk | contribs) (sync with Russian article)
Jump to navigation Jump to search

Tango-emblem-symbolic-link.pngThis article is being considered for redirection to Archiving and compression tools.Tango-emblem-symbolic-link.png

Notes: Content doesn't justify article. (Discuss in Talk:P7zip#)

p7zip is command line port of 7-Zip for POSIX systems, including Linux.

Installation

Install the p7zip package.

The command to run the program is the following:

$ 7z

Examples

Warning: Do not use 7z format for backup purposes, because it doesn't save owner/group of files. See 7z(1) for more details.

Add file/directory to the archive (or create a new one):

$ 7z a <archive name> <file name>

Also it is possible to set password with flag -p and hide structure of the archive with flag -mhe=on:

$ 7z a <archive name> <file name> -p<password> -mhe=on

Update existing files in the archive or add new ones:

$ 7z u <archive name> <file name>

List the content of an archive:

$ 7z l <archive name>

Extract all files from an archive to the current directory without using directory names:

$ 7z e <archive name>

Extract with full paths:

$ 7z x <archive name>

Extract into a new directory:

$ 7z x -o<folder name> <archive name>

Check integrity of the archive:

$ 7z t <archive name>

Differences between 7z, 7za and 7zr binaries

The package includes three binaries, /usr/bin/7z, /usr/bin/7za, and /usr/bin/7zr. Their manual pages explain the differences:

  • 7z(1) uses plugins to handle archives.
  • 7za(1) is a stand-alone executable that handles fewer archive formats than 7z.
  • 7zr(1) is a stand-alone executable. It is a "light-version" of 7za that only handles 7z archives. In contrast to 7za, it cannot handle encrypted archives.

Troubleshooting

ZIP archives are extracted with wrong encoding

If you see file/directory names extracted with wrong encoding, install unzip-iconvAUR. Usually it happens with archives created in the Windows File Explorer. Consider using 7-Zip in order to avoid such problems in the future.

See also