LinuxCommandLibrary

7z

high-compression file archiver supporting multiple formats

TLDR

Create archive

$ 7z a [archive.7z] [files...]
copy
Extract archive
$ 7z x [archive.7z]
copy
Extract to specific directory
$ 7z x [archive.7z] -o[directory]
copy
List archive contents
$ 7z l [archive.7z]
copy
Test archive integrity
$ 7z t [archive.7z]
copy
Create with password
$ 7z a -p[password] [archive.7z] [files]
copy
Create with maximum compression
$ 7z a -mx=9 [archive.7z] [files]
copy

SYNOPSIS

7z command [switches] archive [files...]

DESCRIPTION

7z is the command-line interface to the 7-Zip archiver, supporting many formats: 7z, ZIP, TAR, GZIP, BZIP2, XZ, and more.
The 7z format offers high compression ratios using LZMA/LZMA2 algorithms, often 30-70% better than ZIP. It also supports AES-256 encryption and multi-volume archives.
Extraction supports many additional formats including RAR, CAB, ISO, and others (read-only for some formats).

PARAMETERS

-odir

Output directory (no space after -o)
-ppassword
Set password
-mx=n
Compression level (0=store, 9=ultra)
-ttype
Archive type (7z, zip, tar, gzip, bzip2)
-mhe=on
Encrypt filenames (7z format)
-r
Recurse subdirectories
-y
Assume yes to all queries
-vsize
Create volumes (e.g., -v100m)

COMMANDS

a

Add files to archive
x
Extract with full paths
e
Extract (flat, no paths)
l
List archive contents
t
Test archive integrity
d
Delete from archive
u
Update archive

CAVEATS

The 7z format is not as universally supported as ZIP. Consider ZIP for maximum compatibility.
-o has no space: -o/path not -o /path.
RAR creation requires separate RAR tools. 7z can only extract RAR files.
Split archives (-v) require all volumes for extraction.

SEE ALSO

7za(1), 7zr(1), tar(1), gzip(1), zip(1)

> TERMINAL_GEAR

Curated for the Linux community

nuphy Air75 V2 Portable 75% Mechanical Keyboard,Wireless Keyboard

nuphy Air75 V2 Portable 75% Mechanical Keyboard,Wireless Keyboard

$129.95
KIWITATA 2X Classic SNES USB Controller for PC Gamings, Retro SNES Wired USB Game Emulator Controller for Windows XP 7 8 11 Mac Raspberry Pi

KIWITATA 2X Classic SNES USB Controller for PC Gamings, Retro SNES Wired USB Game Emulator Controller for Windows XP 7 8 11 Mac Raspberry Pi

$16.99
BOSGAME Mini PC N95, Intel 12th Mini Computers| 16GB DDR4 RAM| 512GB M.2 2280 SSD| 4K 60HZ Triple Displays by Dual HDMI+Type-C, 6W TDP Quiet Mini PC, WIFI5, BT 5.0 Office

BOSGAME Mini PC N95, Intel 12th Mini Computers| 16GB DDR4 RAM| 512GB M.2 2280 SSD| 4K 60HZ Triple Displays by Dual HDMI+Type-C, 6W TDP Quiet Mini PC, WIFI5, BT 5.0 Office

$239.99
Copied to clipboard

> TERMINAL_GEAR

Curated for the Linux community

New Raspberry Pi 3 Model B+ Board Raspberry PI 3B+

New Raspberry Pi 3 Model B+ Board Raspberry PI 3B+

$54.00
Raspberry Pi 5 8GB

Raspberry Pi 5 8GB

$134.50
BOSGAME Mini PC N95, Intel 12th Mini Computers| 16GB DDR4 RAM| 512GB M.2 2280 SSD| 4K 60HZ Triple Displays by Dual HDMI+Type-C, 6W TDP Quiet Mini PC, WIFI5, BT 5.0 Office

BOSGAME Mini PC N95, Intel 12th Mini Computers| 16GB DDR4 RAM| 512GB M.2 2280 SSD| 4K 60HZ Triple Displays by Dual HDMI+Type-C, 6W TDP Quiet Mini PC, WIFI5, BT 5.0 Office

$239.99