7-Zip is a powerful command-line archive utility that compresses files more efficiently than standard ZIP tools while also supporting formats like RAR, TAR, and ISO that other tools cannot extract. Whether you need to reduce backup sizes, extract downloaded archives, or encrypt sensitive files with AES-256, 7-Zip handles these tasks efficiently. By the end of this guide, you will have 7-Zip installed on Debian 11, 12, or 13, verified working, and ready to compress, extract, and manage archives.
Understand 7-Zip Packaging on Debian
Debian’s 7-Zip packaging changed significantly between releases. Understanding these differences ensures you install the correct package and use the right command for your version:
- Debian 13 (Trixie): Install the
7zippackage, which provides the7zcommand. This is the official 7-Zip from Igor Pavlov. - Debian 12 (Bookworm): Install the
7zippackage, but the command is7zz(not7z). This is also the official 7-Zip. - Debian 11 (Bullseye): The
7zippackage does not exist. Instead, installp7zip-full, which provides the7zcommand. This is the p7zip fork, not the official 7-Zip.
All packages are available in Debian’s default main repository—no additional repositories are required.
Choose Your 7-Zip Installation Method
Debian offers two ways to install 7-Zip: APT (Advanced Package Tool, Debian’s standard package manager) or a manual binary download from the official GitHub releases. On one hand, the APT method provides automatic updates and integrates with your system’s package management. On the other hand, the manual method lets you install the latest upstream version immediately.
| Method | Channel | Version | Updates | Best For |
|---|---|---|---|---|
| APT Package Manager | Debian Repos | Stable per release | Automatic via apt upgrade | Most users who want simple maintenance |
| Manual Binary | GitHub Releases | Latest upstream | Manual re-download | Users who need newest features immediately |
For most users, the APT method is recommended because all supported Debian versions include 7-Zip (or p7zip) in their default repositories with automatic security updates and no manual maintenance required. Only use the manual binary method if you specifically need a newer version than what Debian provides.
Update Debian Before Installation
Before installing any software, update your package lists and upgrade existing packages to ensure compatibility and security:
sudo apt update && sudo apt upgrade
Install 7-Zip with APT (Recommended)
Follow the instructions for your specific Debian version. The package name and command differ between releases.
Debian 13 (Trixie)
Debian 13 includes the official 7-Zip package with the familiar 7z command:
sudo apt install 7zip
Verify the installation:
7z
Expected output:
7-Zip 25.01 (x64) : Copyright (c) 1999-2025 Igor Pavlov : 2025-08-03 64-bit locale=C.UTF-8 Threads:4 OPEN_MAX:1024, ASM Usage: 7z <command> [<switches>...] <archive_name> [<file_names>...] [@listfile]
The package provides 7z (full-featured), 7za (standalone), and 7zr (reduced version for .7z files only). For most tasks, use 7z.
Debian 12 (Bookworm)
Debian 12 includes the official 7-Zip package, but the binary is named 7zz instead of 7z:
sudo apt install 7zip
Verify the installation using the correct command:
7zz
Expected output:
7-Zip (z) 22.01 (x64) : Copyright (c) 1999-2022 Igor Pavlov : 2022-07-15 64-bit locale=C.UTF-8 Threads:4 Usage: 7zz <command> [<switches>...] <archive_name> [<file_names>...] [@listfile]
Remember to use 7zz for all commands in the examples below if you are on Debian 12.
Debian 11 (Bullseye)
Debian 11 does not have the 7zip package. Instead, install p7zip-full, which is a community fork that provides compatible functionality:
sudo apt install p7zip-full
Verify the installation:
7z
Expected output:
7-Zip [64] 16.02 : Copyright (c) 1999-2016 Igor Pavlov : 2016-05-21 p7zip Version 16.02 (locale=C.UTF-8,Utf16=on,HugeFiles=on,64 bits,4 CPUs) Usage: 7z <command> [<switches>...] <archive_name> [<file_names>...]
The p7zip package provides 7z and 7za commands that work identically to the official 7-Zip for standard operations.
Install 7-Zip from Official Binary (Alternative)
If you need the latest version or want 7-Zip without root access, download the official binary directly from the 7-Zip GitHub releases page. The manual binary is always named 7zz regardless of your Debian version, and you can install it system-wide (with sudo) or in your home directory (without sudo). First, determine your system architecture:
dpkg --print-architecture
Expected output for 64-bit Intel/AMD systems:
amd64
Other possible outputs include arm64 for ARM-based systems or i386 for 32-bit systems. Once you know your architecture, download the latest version automatically using the GitHub API:
curl -s https://api.github.com/repos/ip7z/7zip/releases/latest | grep -oP '"browser_download_url": "\K[^"]+linux-x64[^"]+' | xargs wget
This command automatically fetches the latest version. Here is how it works:
curl -s: Silently fetches release metadata from GitHub’s APIgrep -oP: Extracts the x64 Linux download URL using regexxargs wget: Downloads the tarball using the extracted URL
For ARM64 systems, replace
linux-x64withlinux-arm64in the grep pattern. Minimal or server installations may needsudo apt install curl wget xz-utilsfirst. If the automated download fails, visit the 7-Zip releases page manually and download the appropriate archive for your architecture.
Next, extract the downloaded archive:
tar xf 7z*-linux-x64.tar.xz
The archive contains a binary named 7zz. You have two installation options depending on whether you have root access.
Option A: System-Wide Installation (Requires sudo)
Move the binary to a system-wide location so all users can access it:
sudo mv 7zz /usr/local/bin/
Verify the installation:
7zz
Expected output:
7-Zip (z) 25.01 (x64) : Copyright (c) 1999-2025 Igor Pavlov : 2025-08-03 64-bit locale=C.UTF-8 Threads:4 OPEN_MAX:1024, ASM Usage: 7zz <command> [<switches>...] <archive_name> [<file_names>...] [@listfile]
Option B: User-Local Installation (No sudo Required)
If you do not have root access or prefer to keep the binary in your home directory, install it to ~/.local/bin:
mkdir -p ~/.local/bin && mv 7zz ~/.local/bin/
Ensure ~/.local/bin is in your PATH. Check with:
echo $PATH | grep -o '\.local/bin'
If this returns nothing, add it to your shell configuration:
echo 'export PATH="$HOME/.local/bin:$PATH"' >> ~/.bashrc && source ~/.bashrc
Verify the installation:
7zz
Expected output:
7-Zip (z) 25.01 (x64) : Copyright (c) 1999-2025 Igor Pavlov : 2025-08-03 64-bit locale=C.UTF-8 Threads:4 OPEN_MAX:1024, ASM Usage: 7zz <command> [<switches>...] <archive_name> [<file_names>...] [@listfile]
The manual binary is always named
7zz. The APT package provides7zon Debian 11 and 13, but7zzon Debian 12. All commands work identically—only the binary name differs.
Manage Archives with 7-Zip Commands
After installing 7-Zip, you can compress, extract, and manage archives from the command line. The examples below use 7z. Substitute the correct binary name for your setup:
- Debian 11 (APT): Use
7z - Debian 12 (APT): Use
7zz - Debian 13 (APT): Use
7z - Manual binary (any version): Use
7zz
All commands and switches work identically regardless of which binary you use.
Create a Compressed Archive
Compress a file or directory into a .7z archive using the a (add) command:
7z a archive.7z file.txt
Expected output showing compression details:
Creating archive: archive.7z Add new data to archive: 1 file, 12 bytes Files read from disk: 1 Archive size: 244 bytes (1 KiB) Everything is Ok
Similarly, to compress an entire directory including all subdirectories:
7z a backup.7z /path/to/directory/
Extract an Archive
Extract all files from an archive to the current directory using the x command, which preserves directory structure:
7z x archive.7z
Expected output:
Extracting archive: archive.7z Everything is Ok Folders: 1 Files: 3 Size: 32 Compressed: 244
Alternatively, to extract to a specific directory, use the -o switch (note there is no space between -o and the path):
7z x archive.7z -o/path/to/destination/
Instead of
7z x, use7z eto extract all files into a flat directory without preserving folder structure. This is particularly useful when you only care about the files themselves, not their original locations.
List Archive Contents
View the contents of an archive without extracting using the l (list) command:
7z l archive.7z
Expected output showing file details:
Date Time Attr Size Compressed Name ------------------- ----- ------------ ------------ ------------------------ 2025-11-30 22:37:49 D.... 0 0 subdir 2025-11-30 22:37:49 ....A 13 36 file2.txt 2025-11-30 22:37:49 ....A 7 subdir/nested.txt 2025-11-30 22:37:49 ....A 12 test.txt ------------------- ----- ------------ ------------ ------------------------ 2025-11-30 22:37:49 32 36 3 files, 1 folders
As shown above, the output displays each file’s date, attributes, original size, compressed size, and path within the archive.
Update an Existing Archive
Add new files to an existing archive using the u (update) command. This adds new files and replaces existing files only if the source is newer:
7z u archive.7z newfile.txt
Conversely, to delete a file from an archive, use the d command:
7z d archive.7z oldfile.txt
Create an Encrypted Archive
Encrypt an archive with a password using AES-256 encryption:
7z a -p -mhe=on secure.7z sensitive-files/
Here, the -p flag prompts for a password, while -mhe=on encrypts file names in addition to content. Furthermore, 7-Zip handles RAR archives natively when extracting files downloaded from the web. However, if you work frequently with RAR files and need the official unrar utility, see our Debian unrar installation guide for additional options.
Test Archive Integrity
Before relying on an archive for backups or transfers, always verify its integrity using the t (test) command:
7z t archive.7z
Expected output for a valid archive:
Testing archive: archive.7z Everything is Ok Folders: 1 Files: 3 Size: 32 Compressed: 244
In contrast, if corruption exists, 7-Zip reports which files failed the integrity check.
Control Compression Level
Adjust the compression level with -mx followed by a number from 0 (store only, no compression) to 9 (ultra compression). Higher levels compress better but take longer:
7z a -mx9 maximum.7z largefile.iso
Alternatively, for faster compression with slightly larger files, use -mx1:
7z a -mx1 fast.7z largefile.iso
Generally, the default level (-mx5) balances speed and compression for most use cases.
Create Split Archives for Large Files
When archiving files that exceed file size limits (such as email attachments or FAT32 partitions), split the archive into volumes with -v followed by the size:
7z a -v100m split-archive.7z large-backup/
As a result, this creates multiple files named split-archive.7z.001, split-archive.7z.002, and so on, each no larger than 100 MB. Common size suffixes include k (kilobytes), m (megabytes), and g (gigabytes).
Later, to extract a split archive, simply run the extraction command on the first volume:
7z x split-archive.7z.001
Exclude Files by Pattern
Exclude specific files or patterns from compression using -x. To exclude all .log files recursively:
7z a backup.7z project/ -xr!*.log
Here, the r modifier makes the exclusion recursive through subdirectories. Likewise, to exclude multiple patterns, simply repeat the switch:
7z a backup.7z project/ -xr!*.log -xr!*.tmp -xr!node_modules
Troubleshoot 7-Zip Issues
Command Not Found After Manual Installation
If you see this error after manual installation:
bash: 7zz: command not found
The binary may not be in your PATH or was not moved correctly. Verify the binary exists:
ls -la /usr/local/bin/7zz
Expected output when the binary is correctly installed:
-rwxr-xr-x 1 root root 2854912 Aug 3 12:00 /usr/local/bin/7zz
If you see No such file or directory, repeat the move command with sudo:
sudo mv 7zz /usr/local/bin/
However, if the file exists but the command still fails, check that /usr/local/bin is in your PATH:
echo $PATH | grep -o '/usr/local/bin'
Expected output:
/usr/local/bin
If this returns nothing, then /usr/local/bin is not in your PATH. Consequently, either use the full path (/usr/local/bin/7zz) or add it to your shell configuration.
Architecture Mismatch Error
If you downloaded the wrong architecture (for example, x86 on an ARM system), you will see an error like:
bash: /usr/local/bin/7zz: cannot execute binary file: Exec format error
Check your architecture and download the correct binary:
dpkg --print-architecture
Next, remove the incorrect binary and download the matching version:
sudo rm /usr/local/bin/7zz
Afterward, visit the releases page and download the correct archive for your architecture.
Permission Denied When Extracting
If extraction fails with this error:
ERROR: CFileOutStream::Create: Can not open output file: /opt/destination/file.txt System ERROR: Permission denied
This means you are trying to extract to a directory you do not own. Instead, either extract to your home directory or use sudo:
sudo 7z x archive.7z -o/opt/destination/
If your user account lacks sudo privileges, see our guide on adding a user to sudoers on Debian.
Corrupted or Incomplete Archive
If extraction or testing fails with errors like these:
ERROR: CRC Failed : filename.txt ERROR: Data Error in encrypted file. Wrong password?
First, test the archive integrity to confirm which files are affected:
7z t archive.7z
If multiple files fail, the archive may have been corrupted during download or transfer. In that case, re-download the file or request a fresh copy. For encrypted archives showing “Wrong password,” verify you are entering the exact password since passwords are case-sensitive.
Remove 7-Zip from Debian
If you no longer need 7-Zip, remove it based on how you installed it.
Remove APT Installation
For Debian 12 and 13, uninstall the 7zip package:
sudo apt remove --purge 7zip && sudo apt autoremove
For Debian 11, remove the p7zip-full package instead:
sudo apt remove --purge p7zip-full && sudo apt autoremove
Remove Manual Binary Installation
Delete the binary based on where you installed it. For system-wide installation:
sudo rm /usr/local/bin/7zz
For user-local installation:
rm ~/.local/bin/7zz
Clean up leftover files: The downloaded archive and any extracted files remain in your home directory. Remove them manually if no longer needed:
rm ~/7z*-linux-*.tar.xz ~/License.txt ~/readme.txt ~/History.txt
Conclusion
You now have 7-Zip installed on Debian and can compress files with high ratios, extract RAR and ISO archives, and encrypt sensitive data with AES-256. For related file management tasks, explore our guides on extracting RAR archives on Debian or enabling contrib and non-free repositories for additional software access.
Thank you so much! I sware I feel like an idiot sometimes, but its through well documented pages like this that get me through. Im 47 now and been using linux of various flavors for a while, the thing is that I am just not so organized in my head. So i am grateful to you and i try to donate when i can, so I hope your feeling credited well for your service and likely I will be back and be able to help you also. God bless you (whichever one you know)!!