7-Zip handles 7z, ZIP, TAR, GZIP, and ISO archives from the command line, with optional AES-256 encryption for sensitive data. Debian packages 7-Zip under different names and commands across releases, so the correct way to install 7-Zip on Debian depends on your version: Debian 13 and 12 provide the 7zip package, while Debian 11 uses p7zip-full instead.
Install 7-Zip on Debian with APT
APT is the recommended method because all supported Debian versions include 7-Zip in their default main repository with automatic security updates.
| Method | Channel | Version | Updates | Best For |
|---|---|---|---|---|
| APT Package Manager | Debian Repos | Stable per release | Automatic via APT updates | Most users who want simple maintenance |
| Manual Binary | GitHub Releases | Latest upstream | Manual re-download | Users who need newest features or RAR on Debian 12 |
The package name, command binary, and format support differ across Debian releases:
| Debian Version | Package | APT Version | Command | RAR Support |
|---|---|---|---|---|
| Debian 13 (Trixie) | 7zip | 25.x | 7z | Yes |
| Debian 12 (Bookworm) | 7zip | 22.x | 7zz | No |
| Debian 11 (Bullseye) | p7zip-full | 16.x | 7z | Yes |
If you need RAR extraction on Debian 12, use the manual binary method below or see how to install unrar on Debian for dedicated RAR tools.
Update Debian Before Installing 7-Zip
Refresh your package lists so APT can see the latest versions available for your release:
sudo apt update
New to
sudo? See how to add a user to sudoers on Debian.
Optionally, apply all pending updates before installing 7-Zip:
sudo apt upgrade
Install 7-Zip on Debian 13 (Trixie)
Debian 13 includes the official 7-Zip package with the familiar 7z command:
sudo apt install 7zip
Verify the installation:
7z
Example output (truncated):
7-Zip 25.01 (x64) : Copyright (c) 1999-2025 Igor Pavlov : 2025-08-03 Usage: 7z <command> [<switches>...] <archive_name> [<file_names>...] [@listfile]
The package also provides 7za (standalone) and 7zr (reduced, .7z only). Use 7z for most tasks.
Install 7-Zip on 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
Example output (truncated):
7-Zip (z) 22.01 (x64) : Copyright (c) 1999-2022 Igor Pavlov : 2022-07-15 Usage: 7zz <command> [<switches>...] <archive_name> [<file_names>...] [@listfile]
Use 7zz (not 7z) for all commands on Debian 12.
Install p7zip on Debian 11 (Bullseye)
Debian 11 does not have the 7zip package. Install p7zip-full instead, which is a community fork providing compatible functionality:
sudo apt install p7zip-full
Verify the installation:
7z
Example output (truncated):
7-Zip [64] 16.02 : Copyright (c) 1999-2016 Igor Pavlov : 2016-05-21 Usage: 7z <command> [<switches>...] <archive_name> [<file_names>...]
The p7zip-full package provides 7z and 7za commands that work identically to the official 7-Zip commands for standard archive operations.
Install 7-Zip from Official Binary on Debian
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. This is also the simplest way to get RAR/RAR5 extraction on Debian 12. The upstream tarball includes the 7zz binary (and 7zzs), always uses the 7zz command, and supports RAR/RAR5 extraction regardless of Debian version.
Install 7-Zip Prerequisite Tools
The manual method uses curl to query GitHub, wget to download the tarball, and xz-utils to extract it:
sudo apt install ca-certificates curl wget xz-utils
Check 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. Use the matching linux-* filename from the releases page in the download and extraction commands below.
Download the Latest 7-Zip Release
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
If you are not on amd64, replace
linux-x64in both the download and extraction commands with the exact filename from the releases page (for example,linux-arm64orlinux-x86). 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 (use the same linux-* suffix you downloaded):
tar xf 7z*-linux-x64.tar.xz
The archive extracts 7zz, 7zzs, and documentation files into the current directory. You only need 7zz for normal CLI use. You have two installation options depending on whether you have root access.
Install 7-Zip System-Wide (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
Example output (truncated):
7-Zip (z) 26.00 (x64) : Copyright (c) 1999-2026 Igor Pavlov : 2026-02-12 Usage: 7zz <command> [<switches>...] <archive_name> [<file_names>...] [@listfile]
Install 7-Zip for Current User (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'
Expected output when it is present:
.local/bin
If this returns nothing, add it to your shell configuration:
echo 'export PATH="$HOME/.local/bin:$PATH"' >> ~/.bashrc && source ~/.bashrc
Alternatively, open a new terminal window so the updated PATH is loaded automatically.
Verify the installation:
7zz
Example output (truncated):
7-Zip (z) 26.00 (x64) : Copyright (c) 1999-2026 Igor Pavlov : 2026-02-12 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. Command syntax is the same, but format support can differ between packages.
Update the Manual 7-Zip Binary on Debian
Because the manual install bypasses APT, you update it by downloading the latest release and replacing the 7zz binary. The script below checks your current version, compares it to the latest GitHub release, and updates only when needed.
Save this as ~/update-7zz.sh:
cat <<'EOF' > ~/update-7zz.sh
#!/usr/bin/env bash
set -euo pipefail
require_cmd() {
command -v "$1" >/dev/null 2>&1 || { echo "Error: $1 is required."; exit 1; }
}
for cmd in curl tar awk dpkg mktemp install; do
require_cmd "$cmd"
done
if ! command -v 7zz >/dev/null 2>&1; then
echo "Error: 7zz is not in PATH. This script updates the manual 7-Zip binary only."
echo "If you installed via APT, run: sudo apt install --only-upgrade 7zip"
exit 1
fi
INSTALL_PATH="$(command -v 7zz)"
if [ "$INSTALL_PATH" = "/usr/bin/7zz" ]; then
echo "Detected APT-managed 7zz at /usr/bin/7zz."
echo "Update it with: sudo apt install --only-upgrade 7zip"
exit 0
fi
ARCH="$(dpkg --print-architecture)"
case "$ARCH" in
amd64) ARCH_TAG="linux-x64" ;;
arm64) ARCH_TAG="linux-arm64" ;;
armhf) ARCH_TAG="linux-arm" ;;
i386) ARCH_TAG="linux-x86" ;;
*) echo "Unsupported architecture: $ARCH"; exit 1 ;;
esac
API_URL="https://api.github.com/repos/ip7z/7zip/releases/latest"
RELEASE_JSON="$(curl -fsSL "$API_URL")"
LATEST_TAG="$(printf '%s' "$RELEASE_JSON" | awk -F'\"' '/\"tag_name\":/ {print $4; exit}')"
LATEST_URL="$(printf '%s' "$RELEASE_JSON" | awk -F'\"' -v arch="$ARCH_TAG" '/browser_download_url/ && $0 ~ arch {print $4; exit}')"
if [ -z "$LATEST_TAG" ] || [ -z "$LATEST_URL" ]; then
echo "Error: Could not determine the latest release information from GitHub."
exit 1
fi
CURRENT_VERSION="$(7zz -h | awk 'NF {print $3; exit}')"
if [ -z "$CURRENT_VERSION" ]; then
CURRENT_VERSION="unknown"
fi
echo "Detected install: $INSTALL_PATH"
echo "Architecture: $ARCH ($ARCH_TAG)"
echo "Current version: $CURRENT_VERSION"
echo "Latest version: $LATEST_TAG"
if [ "$CURRENT_VERSION" = "$LATEST_TAG" ]; then
echo "7-Zip is already up to date."
exit 0
fi
echo "Updating 7-Zip from $CURRENT_VERSION to $LATEST_TAG..."
WORKDIR="$(mktemp -d)"
trap 'rm -rf "$WORKDIR"' EXIT
ARCHIVE="$WORKDIR/7z-${LATEST_TAG}-${ARCH_TAG}.tar.xz"
curl -fL --progress-bar "$LATEST_URL" -o "$ARCHIVE"
tar -xf "$ARCHIVE" -C "$WORKDIR"
if [ ! -x "$WORKDIR/7zz" ]; then
echo "Error: 7zz not found in the downloaded archive."
exit 1
fi
INSTALL_DIR="$(dirname "$INSTALL_PATH")"
if [ -w "$INSTALL_DIR" ]; then
install -m 0755 "$WORKDIR/7zz" "$INSTALL_PATH"
elif [ "$(id -u)" -eq 0 ]; then
install -m 0755 "$WORKDIR/7zz" "$INSTALL_PATH"
elif command -v sudo >/dev/null 2>&1; then
sudo install -m 0755 "$WORKDIR/7zz" "$INSTALL_PATH"
else
echo "Error: $INSTALL_DIR is not writable and sudo is not available."
echo "Run this script as root or reinstall to ~/.local/bin."
exit 1
fi
echo "Update complete."
7zz -h | awk 'NF {print; exit}'
EOF
Use chmod to make it executable, then run it:
chmod +x ~/update-7zz.sh
~/update-7zz.sh
Example output when you are already on the latest version:
Detected install: /usr/local/bin/7zz Architecture: amd64 (linux-x64) Current version: 26.00 Latest version: 26.00 7-Zip is already up to date.
Avoid automating this with cron. Download failures or permission prompts can leave a partial update, so run the script manually and review the output.
Manage Archives with 7-Zip Commands on Debian
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, but format support differs by package (for example, Debian 12’s 7zz build does not include RAR/RAR5 extraction).
Create a 7-Zip Compressed Archive
Compress a file or directory into a .7z archive using the a (add) command:
7z a archive.7z file.txt
Example output (truncated; sizes vary):
Scanning the drive: 1 file, 5 bytes (1 KiB) Creating archive: archive.7z Add new data to archive: 1 file, 5 bytes (1 KiB) Files read from disk: 1 Archive size: 131 bytes (1 KiB) Everything is Ok
Similarly, to compress an entire directory including all subdirectories:
7z a backup.7z /path/to/directory/
Extract a 7-Zip Archive
Extract all files from an archive to the current directory using the x command, which preserves directory structure:
7z x archive.7z
Example output (truncated; sizes vary):
Scanning the drive for archives: 1 file, 237 bytes (1 KiB) Extracting archive: archive.7z Everything is Ok Folders: 1 Files: 3 Size: 32 Compressed: 237
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 7-Zip Archive Contents
View the contents of an archive without extracting using the l (list) command:
7z l archive.7z
Example output (truncated; dates and sizes vary):
Date Time Attr Size Compressed Name ------------------- ----- ------------ ------------ ------------------------ 2025-12-27 08:29:10 D.... 0 0 subdir 2025-12-27 08:29:10 ....A 13 34 file2.txt 2025-12-27 08:29:10 ....A 7 subdir/nested.txt 2025-12-27 08:29:10 ....A 12 test.txt ------------------- ----- ------------ ------------ ------------------------ 2025-12-27 08:29:10 32 34 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 7-Zip 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 7-Zip 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.
Test 7-Zip Archive Integrity
Before relying on an archive for backups or transfers, always verify its integrity using the t (test) command:
7z t archive.7z
Example output (truncated; sizes vary):
Scanning the drive for archives: 1 file, 237 bytes (1 KiB) Testing archive: archive.7z Everything is Ok Folders: 1 Files: 3 Size: 32 Compressed: 237
In contrast, if corruption exists, 7-Zip reports which files failed the integrity check.
Control 7-Zip 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 7-Zip 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 with 7-Zip
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 on Debian
Use the same binary name you installed in the commands below (7z or 7zz).
7zz 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 -lh /usr/local/bin/7zz
If you installed to ~/.local/bin, check that location instead:
ls -lh ~/.local/bin/7zz
Example output (size and timestamp vary):
-rwxr-xr-x 1 root root 2.8M Aug 3 18:08 /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.
7-Zip 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.
7-Zip 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 how to add a user to sudoers on Debian.
Corrupted or Incomplete 7-Zip 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 7-Zip 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
If you also installed the manual binary, it will still be present in /usr/local/bin or ~/.local/bin until you remove it in the next section.
Verify the APT removal:
Debian 11 and 13:
7z
bash: 7z: command not found
Debian 12:
7zz
bash: 7zz: command not found
Remove 7-Zip 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
Verify the binary is gone from the location you used:
ls -la /usr/local/bin/7zz
ls: cannot access '/usr/local/bin/7zz': No such file or directory
ls -la ~/.local/bin/7zz
ls: cannot access '/home/user/.local/bin/7zz': No such file or directory
If you added ~/.local/bin to your PATH, remove that line from ~/.bashrc or ~/.profile and open a new terminal session.
Clean up leftover files in the directory where you extracted 7-Zip:
rm ~/7z*-linux-*.tar.xz ~/7zzs ~/readme.txt ~/License.txt ~/History.txt. Remove theMANUALdirectory if you do not need the HTML docs.
Frequently Asked Questions
On Debian 13 and 11 (via p7zip-full), the command is 7z. On Debian 12, the 7zip package provides only the 7zz binary. The manual binary from GitHub also uses 7zz. Command syntax and switches are identical between 7z and 7zz.
It depends on the version. Debian 13’s 7zip package (25.x) and Debian 11’s p7zip-full both include RAR/RAR5 extraction. Debian 12’s 7zip package (22.x) does not. For RAR on Debian 12, install the manual binary from GitHub or use unrar on Debian.
First confirm which package is installed with dpkg -l 7zip p7zip-full. On Debian 12, the correct command is 7zz, not 7z. If neither package is installed, run sudo apt install 7zip (Debian 12/13) or sudo apt install p7zip-full (Debian 11). For the manual binary, verify that /usr/local/bin or ~/.local/bin is in your PATH.
Conclusion
7-Zip is ready to compress, extract, and encrypt archives on your Debian system. The APT package handles updates automatically, while the manual binary paired with the update script keeps the latest upstream features available. For RAR-only extraction needs, see how to install unrar on Debian. To access additional Debian packages outside the main repository, learn how to enable contrib and non-free repositories on Debian.
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)!!