Skip to main content

Quick Start Guide

This guide will get you up and running with 7-Zip quickly. You’ll learn the most common operations: creating archives, extracting files, listing contents, and testing archive integrity.
On Linux/macOS, use 7zz as the command. On Windows, use 7z (or 7z.exe with full path). The examples below use 7z for simplicity, but both work identically.

Basic Command Structure

7-Zip commands follow this pattern:
7z <command> [<switches>...] <archive_name> [<file_names>...]
  • command - Single letter command (a, x, e, l, t, etc.)
  • switches - Optional parameters starting with -
  • archive_name - Name of the archive file
  • file_names - Files or directories to process

Creating Your First Archive

1

Create a simple archive

Compress a single file or directory into a 7z archive:
# Compress a file
7zz a documents.7z file.txt

# Compress a directory
7zz a backup.7z /home/user/Documents

# Compress multiple files
7zz a photos.7z photo1.jpg photo2.jpg photo3.jpg
The a command means add to archive. If the archive doesn’t exist, 7-Zip creates it.
2

Set compression level

Control the compression ratio vs. speed tradeoff:
# Fast compression (less compression)
7z a -mx1 fast.7z bigfile.dat

# Normal compression (default)
7z a -mx5 normal.7z bigfile.dat

# Maximum compression (slower)
7z a -mx9 small.7z bigfile.dat
Compression levels:
  • -mx0 - Store only (no compression)
  • -mx1 - Fastest compression
  • -mx3 - Fast compression
  • -mx5 - Normal (default)
  • -mx7 - Maximum
  • -mx9 - Ultra (slowest, best compression)
3

Create a password-protected archive

Add encryption to protect sensitive data:
# Create encrypted archive
7z a -p secret.7z confidential.pdf
7-Zip will prompt you to enter a password. To specify the password inline:
7z a -pMySecretPassword secure.7z data.txt
7-Zip uses AES-256 encryption for 7z archives, which is considered very secure. Avoid using inline passwords in scripts as they may be visible in command history.
4

Create archives in other formats

Use the -t switch to specify the archive format:
# Create ZIP archive
7z a -tzip archive.zip files/

# Create TAR.GZ archive (Linux/macOS)
7z a -ttar files.tar files/
7z a -tgzip files.tar.gz files.tar

# Or in one command
tar -czf files.tar.gz files/  # Using system tar

# Create BZIP2 archive
7z a -tbzip2 archive.tar.bz2 files.tar
Supported archive types for creation:
  • 7z - 7-Zip native format (default, best compression)
  • zip - ZIP archive
  • gzip - GZIP compressed
  • bzip2 - BZIP2 compressed
  • tar - TAR archive (no compression)
  • wim - Windows Imaging Format
  • xz - XZ compressed

Extracting Archives

1

Extract with full paths

Use the x command to extract files with their directory structure:
# Extract archive to current directory
7zz x archive.7z

# Extract to specific directory
7zz x archive.7z -o/home/user/extracted/

# Extract with yes to all prompts
7zz x archive.7z -y
Note: There is no space between -o and the path. The correct syntax is -o/path/ not -o /path/.
2

Extract without paths

Use e to extract all files to a single directory (no subdirectories):
# Extract everything to current directory (flattened)
7z e archive.7z

# Extract to specific directory (flattened)
7z e archive.7z -o/tmp/files/
The e command extracts all files to the same folder, ignoring the original directory structure.
3

Extract password-protected archives

Provide the password when extracting encrypted archives:
# Prompt for password
7z x protected.7z -p

# Provide password inline
7z x protected.7z -pMySecretPassword
4

Extract specific files

Extract only certain files from an archive:
# Extract single file
7z x archive.7z readme.txt

# Extract files matching pattern
7z x archive.7z "*.jpg"

# Extract specific directory
7z x archive.7z docs/

Listing Archive Contents

Before extracting, you can view what’s inside an archive:
1

List files in archive

Use the l (list) command:
# Basic listing
7z l archive.7z
Output shows:
  • Date and time
  • File attributes
  • File size
  • Compressed size
  • File name
2

Show technical information

Get detailed technical information about the archive:
7z l -slt archive.7z
This displays:
  • Compression method
  • CRC checksums
  • Encryption details
  • Block information
  • Archive properties

Testing Archives

Verify archive integrity without extracting:
# Test archive integrity
7z t archive.7z

# Test with password
7z t protected.7z -pPassword123

# Test specific files
7z t archive.7z "*.txt"
The t command checks:
  • CRC checksums
  • Archive structure
  • Compression integrity
  • File data validity
Always test archives after creation, especially for important backups, to ensure they weren’t corrupted during creation or transfer.

Common Use Cases

Backup a Directory

# Create compressed backup with maximum compression
7z a -mx9 backup-$(date +%Y%m%d).7z /home/user/important_data/

# With encryption
7z a -mx9 -p backup-$(date +%Y%m%d).7z /home/user/important_data/

Split Large Archives into Volumes

# Split into 100MB volumes
7z a -v100m large_archive.7z /path/to/big/files/

# Split into 4.7GB volumes (DVD size)
7z a -v4700m dvd_backup.7z /media/files/
This creates:
  • large_archive.7z.001
  • large_archive.7z.002
  • large_archive.7z.003
  • etc.
To extract, just use the first volume:
7z x large_archive.7z.001

Update Existing Archive

# Update archive (add new files, update modified files)
7z u archive.7z newfile.txt

# Add files recursively from directory
7z u archive.7z /home/user/documents/ -r

Delete Files from Archive

# Delete specific file
7z d archive.7z oldfile.txt

# Delete files matching pattern
7z d archive.7z "*.tmp"

Hash Calculation

# Calculate SHA-256 hash
7z h -scrcSHA256 file.iso

# Calculate CRC32
7z h -scrcCRC32 file.zip

# Calculate multiple hashes for multiple files
7z h -scrcSHA256 *.zip

Benchmark System Performance

Test your CPU’s compression and decompression speed:
# Run benchmark (default)
7z b

# Benchmark with specific number of threads
7z b -mmt4

# Benchmark specific compression method
7z b -mm=LZMA2

Useful Switches Reference

Here are the most commonly used switches:
SwitchDescriptionExample
-o<path>Set output directory7z x file.7z -o/tmp/
-p<pwd>Set password7z a -pSecret file.7z data.txt
-mx<level>Set compression level (0-9)7z a -mx9 file.7z data/
-mmt<N>Set number of CPU threads7z a -mmt4 file.7z data/
-rRecurse subdirectories7z a file.7z *.txt -r
-t<type>Set archive type7z a -tzip file.zip data/
-v<size>Create volumes7z a -v100m file.7z data/
-yAssume Yes on all queries7z x file.7z -y
-bdDisable progress indicator7z a file.7z data/ -bd
-sdelDelete files after archiving7z a file.7z *.log -sdel
-ao<mode>Overwrite mode (a/s/t/u)7z x file.7z -aoa
-sltShow technical info7z l -slt file.7z
-bb<level>Set output log level (0-3)7z a file.7z data/ -bb3

Command Quick Reference

CommandDescriptionExample
aAdd files to archive7z a archive.7z files/
xExtract with full paths7z x archive.7z
eExtract without paths7z e archive.7z
lList contents7z l archive.7z
tTest archive integrity7z t archive.7z
uUpdate archive7z u archive.7z newfile.txt
dDelete from archive7z d archive.7z oldfile.txt
hCalculate hash7z h -scrcSHA256 file.iso
bBenchmark7z b
iShow codec info7z i
rnRename files in archive7z rn archive.7z old.txt new.txt

Best Practices

  1. Use 7z format for best compression - The native 7z format provides better compression than ZIP
  2. Test archives after creation - Always use 7z t to verify integrity
  3. Choose appropriate compression levels - Use -mx1 for speed, -mx9 for size
  4. Use password protection for sensitive data - 7-Zip uses strong AES-256 encryption
  5. Enable multi-threading - Use -mmt to utilize all CPU cores for faster compression
  6. Split large archives - Use -v to create volumes that fit on media or have size limits

Next Steps

Command Reference

Explore all available commands and switches in detail

Advanced Usage

Learn advanced techniques like SFX archives, filtering, and automation

Format Specifications

Understand the 7z format and other supported archive types

Compression Methods

Deep dive into LZMA, LZMA2, PPMd, and other compression algorithms

Build docs developers (and LLMs) love