Command Line Version User's Guide
7z.exe is the command line version of 7-Zip. 7z.exe uses 7z.dll
from the 7-Zip package. 7z.dll is used by the 7-Zip File Manager also.
7za.exe (a = alone) is a standalone version of 7-Zip.
7za.exe supports only 7z, xz, lzma, cab, zip, gzip, bzip2 and tar formats.
7za.exe doesn't use external modules.
Notes from this site
Not part of the 7-Zip manual. Written by this site; examples checked with 7-Zip 26.04.
7z, 7za, 7zz or 7zr: which program do I run?
Program Where Formats
7z.exeWindows; needs 7z.dll from the same package The formats 7z.dll supports
7za.exeWindows standalone 7z, xz, lzma, cab, zip, gzip, bzip2, tar
7zzLinux, macOS (official console build) Many formats, but some can only be opened, not created (for example, -trar fails with E_NOTIMPL on 7zz 26.04). The exact set depends on the build: run 7zz i
7zr.exeWindows; described only in the Bundle section of readme.txt, not on this page readme.txt describes it as a standalone console for the 7z format only
This manual writes 7z in its examples. On Linux and macOS type 7zz instead; everything else is identical.
What is the simplest command to compress or extract?
7zz a archive.7z folder/ # compress a folder
7zz x archive.7z # extract here, keeping folders
7zz x archive.7z -oextracted # extract into ./extracted
7zz e archive.7z # extract all files flat, without folders
7zz l archive.7z # list contents
7zz t archive.7z # test integrity
7zz x proj.tar.gz && 7zz x proj.tar # .tar.gz is two steps: gzip, then tar
for f in *.7z; do 7zz x "$f" -o"${f%.7z}"; done # many archives, one folder each
Use x unless you really want every file in one folder: e drops the folder structure, and files with the same name then clash.
Pick a task
The commands are a add, x and e extract, l list, t test, d delete, u update (see Commands ). The five switches used most: -o (target folder), -p , -mx (compression level), -x (skip files) and -r (recurse into folders).
Hide file names in a password-protected 7z: -mhe
Split into parts: -v
Check success in a script: exit codes
Quotes, spaces, wildcards and the order of switches: command line syntax