Archive work on Debian gets confusing because 7zip, p7zip-full, 7z, and 7zz do not line up the same way on each release. To install 7-Zip on Debian, use the distro package for normal APT-managed compression and extraction, then choose the manual upstream binary only when you need the newest release or upstream RAR/RAR5 extraction.
Install 7-Zip on Debian with APT
APT is the recommended method because all supported Debian versions include a 7-Zip package in the default main repository with package-manager updates.
| Method | Channel | What You Get | Updates | Best For |
|---|---|---|---|---|
| APT Package Manager | Debian Repos | Debian-maintained package for your release | APT-managed updates | Most users who want simple maintenance |
| Manual Binary | GitHub Releases | Latest upstream 7zz binary | Manual replacement or helper script | Users who need newest features or upstream RAR/RAR5 support |
The package name, command binary, and format support differ across Debian releases:
| Debian Version | Package | Runtime Version | Command | RAR/RAR5 Notes |
|---|---|---|---|---|
| Debian 13 (Trixie) | 7zip | 25.01 | 7z | Limited in main |
| Debian 12 (Bookworm) | 7zip | 25.01 | 7zz | Not included |
| Debian 11 (Bullseye) | p7zip-full | 25.01 through p7zip | 7z | Limited in main |
Older Debian examples may mention p7zip-full for every release. On Debian 13, p7zip-full is transitional; on Debian 12, it remains available for compatibility. For new installs, use 7zip on Debian 12 and 13, and use p7zip-full on Debian 11 so the package and command name match your release.
Debian’s
mainpackages can identify some RAR archives, but full RAR/RAR5 support is separated from the base packages. For reliable RAR extraction, use the manual binary method 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) 25.01 (x64) : Copyright (c) 1999-2025 Igor Pavlov : 2025-08-03 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 provides the compatible 7z command on Bullseye:
sudo apt install p7zip-full
Verify the installation:
7z
Example output (truncated):
7-Zip [64] 25.01 : Copyright (c) 1999-2025 Igor Pavlov : 2025-08-03 p7zip Version 16.02
The p7zip-full package provides 7z and 7za commands. Use 7z for normal archive operations on Debian 11, and remember that Debian 12 uses 7zz for the 7zip package instead.
Install 7-Zip from Official Binary on Debian
If you need the latest version, upstream RAR/RAR5 extraction, or 7-Zip without root access, download the official binary directly from the 7-Zip GitHub releases page. The upstream tarball includes the 7zz binary (and 7zzs), always uses the 7zz command, and keeps format support independent from Debian’s package splits.
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.
Download the Latest 7-Zip Release
release_json=$(curl -fsSL https://api.github.com/repos/ip7z/7zip/releases/latest)
download_url=$(printf '%s\n' "$release_json" | awk -F'"' '/browser_download_url/ && /linux-x64/ && /tar.xz/ {print $4; exit}')
if [ -n "$download_url" ]; then
archive_name=${download_url##*/}
wget -O "$archive_name" "$download_url"
else
printf 'No linux-x64 tarball found. Check the 7-Zip releases page.\n' >&2
fi
This sequence fetches the latest release metadata, extracts the x64 Linux tarball URL, stores the upstream filename in archive_name, and downloads the tarball. It also fails visibly when GitHub cannot be reached or the expected asset name changes.
curl -fsSL: Fetches release metadata and fails on HTTP errorsawk -F'"': Extracts the firstlinux-x64tarball URL from the JSON textwget -O "$archive_name": Saves the tarball using the filename from the release asset URL
If you are not on amd64, replace
linux-x64in the download filter with the exact filename pattern 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. If you downloaded the file manually or opened a new terminal, replace $archive_name with the tarball filename you downloaded:
tar xf "$archive_name"
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.01 (x64) : Copyright (c) 1999-2026 Igor Pavlov : 2026-04-27 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.01 (x64) : Copyright (c) 1999-2026 Igor Pavlov : 2026-04-27 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 helper script 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.01 Latest version: 26.01 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.
Use 7-Zip Commands on Debian
After installation, the main 7-Zip syntax is 7z command switches archive files. The examples use 7z because that is the command on Debian 13 and Debian 11; on Debian 12 or a manual install, type 7zz in the same position.
| Command | Purpose | Typical Use |
|---|---|---|
a | Add files or create an archive | Create .7z or .zip files |
x | Extract with full paths | Restore an archive with folders intact |
e | Extract without paths | Pull files into one flat directory |
l | List archive contents | Inspect files before extracting |
t | Test archive integrity | Check backups or downloads |
u | Update an archive | Add newer files without rebuilding from scratch |
d | Delete from an archive | Remove a stored file from the archive only |
Create a disposable practice directory so the commands have real paths to work with:
mkdir -p ~/archive-demo/project/logs
printf 'config=1\n' > ~/archive-demo/project/config.txt
printf 'keep\n' > ~/archive-demo/project/readme.md
printf 'debug\n' > ~/archive-demo/project/logs/app.log
printf 'cache\n' > ~/archive-demo/project/cache.tmp
cd ~/archive-demo
Create a 7z Archive from a Directory
Use a to add files to a new archive. The .7z extension tells 7-Zip to use its native format with LZMA/LZMA2 compression.
7z a project.7z project/
Successful output ends with Everything is Ok. Sizes vary by file content, but the important signal is that 7-Zip scanned the source directory, created the archive, and wrote the requested files.
Scanning the drive: 2 folders, 4 files, 26 bytes (1 KiB) Creating archive: project.7z Add new data to archive: 2 folders, 4 files, 26 bytes (1 KiB) Files read from disk: 4 Archive size: 270 bytes (1 KiB) Everything is Ok
To archive one file instead of a directory, place the file path after the archive name:
7z a single-file.7z project/config.txt
Create a ZIP Archive with 7-Zip
Use -tzip when the recipient needs a standard ZIP file instead of a native 7z archive. This is useful for sharing with Windows users, web forms, or tools that do not understand .7z.
7z a -tzip project.zip project/
7-Zip can create and extract ZIP files, but simple ZIP-only extraction is often easier with Debian’s dedicated unzip command examples.
List Files Before Extracting
Run l when you want to check paths, dates, and file names before writing anything to disk:
7z l project.7z
Relevant output includes the stored paths and a summary count; dates and compressed sizes vary:
Date Time Attr Size Compressed Name ------------------- ----- ------------ ------------ ------------------------ 2026-05-19 08:58:01 D.... 0 0 project 2026-05-19 08:58:01 D.... 0 0 project/logs 2026-05-19 08:58:01 ....A 6 30 project/cache.tmp 2026-05-19 08:58:01 ....A 9 project/config.txt 2026-05-19 08:58:01 ....A 6 project/logs/app.log 2026-05-19 08:58:01 ....A 5 project/readme.md ------------------- ----- ------------ ------------ ------------------------ 2026-05-19 08:58:01 26 30 4 files, 2 folders
The Name column shows how extraction paths will be recreated. If the archive contains a top-level project/ directory, 7z x restores that directory by default.
Extract Archives with or without Folders
Use x for normal extraction because it preserves the original folder structure. The -o switch chooses the output directory, and 7-Zip expects the path to touch the switch with no space.
7z x project.7z -oextract
Successful extraction ends with a folder and file count:
Extracting archive: project.7z Everything is Ok Folders: 2 Files: 4 Size: 26 Compressed: 270
Use e only when you intentionally want all files placed into one flat directory. Files with the same name from different folders can collide, so x is safer for backups and source trees.
7z e project.7z -oflat
Update or Delete Files Inside an Archive
The u command adds new files and replaces files in the archive only when the source copy is newer. It does not delete files that disappeared from the source directory.
printf 'new\n' > project/newfile.txt
7z u project.7z project/newfile.txt
Use d to remove a stored path from the archive. This changes the archive only; it does not delete the source file from your working directory.
7z d project.7z project/readme.md
Create an Encrypted 7z Archive
Use -p without a password value so 7-Zip prompts securely instead of storing the password in your shell history. Add -mhe=on to encrypt file names as well as file contents.
7z a -p -mhe=on secure.7z project/config.txt
When file-name encryption is enabled, listing or extracting the archive also requires the password. Keep that password somewhere recoverable because 7-Zip cannot restore it.
Test Archive Integrity Before Trusting It
Use t after downloads, transfers, or backup jobs. This reads the archive and verifies stored checksums without extracting files.
7z t project.7z
A healthy archive reports Everything is Ok:
Testing archive: project.7z Everything is Ok Folders: 2 Files: 4 Size: 25 Compressed: 278
If the archive is damaged or an encrypted archive has the wrong password, 7-Zip reports an error instead of Everything is Ok.
Choose a Compression Level
The -mx switch controls compression effort from -mx0 to -mx9. Higher values can reduce size, but they also use more CPU and take longer on large archives.
| Switch | Behavior | Use Case |
|---|---|---|
-mx0 | Store files without compression | Fast packing when files are already compressed |
-mx1 | Fast compression | Large working archives where speed matters |
-mx5 | Default balanced compression | General backups and transfers |
-mx9 | Maximum compression effort | Smaller archives when runtime is acceptable |
7z a -mx9 maximum.7z project/
7z a -mx1 fast.7z project/
Create Split Archives for Large Transfers
Use -v to split an archive into volumes for upload limits, FAT32 storage, or removable media. The example uses 100 MB pieces; common suffixes include k, m, and g.
7z a -v100m split-archive.7z large-backup/
7-Zip creates files such as split-archive.7z.001, split-archive.7z.002, and split-archive.7z.003. Keep every volume in the same directory when extracting, then point 7-Zip at the first volume.
7z x split-archive.7z.001
Exclude Logs, Caches, and Build Output
Use -x to exclude files. Quote switches that contain ! so Bash does not treat the exclamation mark as history expansion in interactive shells.
7z a backup.7z project/ '-xr!*.log' '-xr!*.tmp'
The r modifier makes the exclusion recursive through subdirectories. Repeat the switch for each pattern you want to skip.
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 diagnostic commands: 7z on Debian 13 and Debian 11, or 7zz on Debian 12 and manual installs.
Fix 7z or 7zz Command Not Found
The most common cause is running the command name for the wrong Debian release. Debian 12’s APT package uses 7zz, while Debian 13 and Debian 11 use 7z.
dpkg -l 7zip p7zip-full | grep '^ii'
command -v 7z || command -v 7zz
If no installed package appears, install 7zip on Debian 12 or 13, or p7zip-full on Debian 11. If 7zip is installed on Debian 12 and command -v 7z still fails, run 7zz instead.
7zz Command Not Found After Manual Binary 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
Review the apt autoremove package list before confirming, especially on systems where other archive tools or desktop file managers depend on shared libraries.
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.
From the directory where you extracted the upstream tarball, remove the extra files if you no longer need them. Delete the downloaded 7z...linux-...tar.xz file by its actual filename rather than using a broad home-directory glob.
rm -f 7zzs readme.txt License.txt History.txt
rm -rf MANUAL
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)!!