7z
Compress or extract archives
TLDR
[a]dd a file or directory to a new or existing archive
Encrypt an existing archive (including filenames)
E[x]tract an archive preserving the original directory structure
E[x]tract an archive to a specific directory
E[x]tract an archive to stdout
[a]rchive using a specific archive type
[l]ist the contents of an archive
Set the level of compression (higher means more compression, but slower)
SYNOPSIS
7z [command] [switches...] [archive_name] [file_names]...
PARAMETERS
a
Add files to archive
b
Benchmark compression/decompression speeds
d
Delete files from archive
e
Extract files without paths (to current dir)
h
Calculate hash sums (CRC32, CRC64, SHA1, SHA256, BLAKE2sp)
i
Show list of supported formats
l
List archive contents
rn
Rename files in archive
r
Repair damaged archive
t
Test archive integrity
u
Update existing archive
x
eXtract files with full paths
y
Assume Yes on all queries
-ad
Disable progress/dot display (quiet mode)
-ao{a|e|s}
Set output file overwrite mode: a=overwrite all, e=skip, s=system
-an
Disable archive name field display
-ax{x|y}
eXclude archive files by extension or attributes
-bb[0-3]
Set output log level (0=disable, 3=high)
-bd
Disable progress indicator
-bs{o|e|p}{0|1|2}
Keep memory open for output/error/paging after operation
-bt
Show execution time statistics
-i[{!}]list
Include filenames matching wildcard list (! for exclude)
-m{Params}
Set compression method (e.g., -mx=9 for max compression)
-o{Directory}
Set output directory
-p{Password}
Set password
-r[-|0]
Recurse subdirectories (-r enable, -r- disable)
-sa{Method}
Set archive name method
-scc{UTF-8|WIN|UTF-16LE}
Set charset for console
-scrc[CRC32|CRC64|SHA1|SHA256|BLAKE2sp]
Set hash function
-sdel
Delete source files after adding
-sfx[{VolumeIndex}]{PathToSFXModule}
Create SFX executable
-si{IconIndex}
Set icon index for SFX
-slk
Set large pages size
-slt
Show technical mode in list files
-snh
Store NTFS hard links as links
-snl[-]
Store NTFS symbolic links as links
-sns[-]
Store NTFS alternate streams
-so
Read file names from stdin
-spf
Use fully qualified paths for file names
-spf2
Use absolute paths for file names
-spt-
Exclude file creation timestamps
-ssc[-]
Set sensitive case mode
-sse
Stop switch parsing at file name
-ssl{Size}
Set large page size
-sni
Store NTFS hard links as separate files
-stl
Set archive timestamp from latest file
-stm{Mode}
Set method for multi-threaded open callbacks
-stx{Type}
Exclude archive files by type
-t{Type}
Set archive type (e.g., -t7z, -tzip)
-u[-][p#][q#][r#][x#][y#][z#][!]{CentralDir}
Update options: p=percent newer, q=older, etc.
-v{VolumeSize}[b|k|m|g]
Create multi-volume archive (e.g., -v100m)
-w[{path}]
Assign work directory
-x[{@|!}list][!]
Exclude filenames matching list (@file with list)
-y
Assume Yes on all queries
-z{file}
Read switch params from file
DESCRIPTION
The 7z command is the Linux front-end for 7-Zip, a powerful open-source file archiver renowned for its superior compression ratios. Developed by Igor Pavlov, it supports formats like 7z (LZMA/LZMA2), ZIP, GZIP, BZIP2, XZ, TAR, and more. Key capabilities include creating and extracting archives, strong AES-256 encryption, solid compression for better ratios, multi-threading for speed, and handling files larger than 4GB.
Common operations: add files (a), extract (x or e), list contents (l), test integrity (t), update (u), delete (d). Switches control behavior, such as recursion (-r), password protection (-p), output directory (-o), and compression methods (-m). On Linux, install via p7zip-full or p7zip-rar packages. It's ideal for backups, distribution, and data reduction, outperforming tools like gzip in ratios but sometimes slower.
CAVEATS
Requires p7zip-full package on Debian/Ubuntu; RAR support needs p7zip-rar. High compression (-mx=9) is CPU-intensive and slow. Passwords are visible in process lists unless careful. Large archives may hit memory limits. Not installed by default on most distros.
COMMON EXAMPLES
7z a archive.7z file.txt - create archive
7z x archive.7z - extract with paths
7z x archive.7z -psecret - extract with password
7z a -tzip -mx=9 backup.zip dir/ - ZIP with max compression
FORMATS SUPPORTED
7z, XZ, ZIP, GZIP, BZIP2, TAR, WIM, ARJ, CAB, CHM, CPIO, CramFS, DEB, DMG, FAT, HFS, ISO, LZH, LZMA, MBR, MSI, NSIS, NTFS, PPMd, RAR (read-only without extra pkg), RPM, SquashFS, UDF, UEFI, VHD, VMDK, WIM, XAR, Z
HISTORY
7-Zip originated in 1999 by Igor Pavlov for Windows. Linux port (p7zip) started 2004 via community efforts. p7zip project maintained until 2016; now official 7-Zip includes Unix builds from v16.00 (2016). Widely used for its LZMA efficiency, surpassing PKZIP.


