Back to the command reference

7z

ArchivesFundamentalsReference only

7-Zip: handles 7z, zip, rar and more

Name: 7z = 7-Zip

This command is outside what the site lets you practise (mostly distribution-specific or rarely used tools). This page describes how to use it; try it on your own Linux system.

Description

7z is the command-line 7-Zip (on Linux from the p7zip or 7zip package). It creates highly compressed .7z archives and extracts zip, rar, tar, iso and many more.

Syntax

7z COMMAND [OPTION]... ARCHIVE [FILE]...

Common options

aAdd to an archive
xExtract with full paths
eExtract everything here, without the directories
lList contents
tTest the archive
-oExtract into a directory, with no space: -o/tmp/out
-pA password (right after -p, or leave it out to be asked)

Examples

  • $ 7z a backup.7z projects/

    Create a 7z archive

    Explain
  • $ 7z x archive.rar

    Extract a rar file

    Explain

Related