How to Install 7‑Zip on Debian 10 or 11
If you’ve ever tried to pull an archive from the internet and ended up with a tangle of .zip, .tar.gz, and .7z files, you’ll know why a single tool that can handle every format is handy. The good news: 7‑Zip (the “p7zip” port for Linux) ships in Debian’s repositories, so installing it is as easy as opening a terminal.
Quick Start – One Command
sudo apt-get update && sudo apt-get install p7zip-full
That’s it. You’ll get the 7z command‑line utility and the GUI front‑end “Archive Manager” will automatically know how to open 7‑Zip files.
Why Install from the Official Repo?
When I upgraded my laptop from Debian 9 to Debian 10, a stray update knocked out the old p7zip package. The system tried to use the bundled gzip tool instead, which left me with a half‑extracted folder and an error about “unsupported format.” Installing the current package from the repo fixes that reliably.
Step 1: Refresh Package Lists
sudo apt-get update
This pulls the latest index of packages from Debian’s servers. It’s like giving your system a quick brain‑flush so it knows what’s available. Skipping it can result in “package not found” errors if you’re behind an old mirror.
Step 2: Install p7zip-full
sudo apt-get install p7zip-full
p7zip-full includes both the CLI (7z) and the helper libraries. If you only need command‑line extraction, p7zip will do, but I prefer the full package because it also installs libp7zip0, which powers the Archive Manager integration.
Step 3: Verify the Installation
7z --help
You should see a list of options. If you get a “command not found” message, double‑check that you typed the package name correctly and rerun apt-get.
Using 7‑Zip from the Command Line
Extract a file:
7z x archive.7z
The x option tells 7‑Zip to preserve full paths inside the archive.
List contents without extracting:
7z l archive.zip
Create a new archive:
7z a backup.7z /home/user/documents/*
a stands for “add.” The trailing * expands all files in that directory.
GUI Integration
After installing, open “Files” (Nautilus) and right‑click an archive. You’ll see “Extract Here,” “Open with Archive Manager,” etc. The Archive Manager already knows 7‑Zip thanks to the p7zip-full package, so you don’t need a separate frontend.
Troubleshooting Common Issues
- “Unsupported format” error – Make sure you’re using the latest version of p7zip (apt-get upgrade). Older binaries can miss newer compression methods.
- Permission denied while extracting to /usr/local – That’s expected; 7‑Zip won’t write outside your home directory unless you run it as root. Stick to user folders or use sudo only when necessary.
Optional: Add a Desktop Shortcut
If you prefer double‑clicking the terminal icon, add this script:
#!/bin/bash xterm -hold -e "7z $@"
Save it as 7zip.sh, make it executable (chmod +x 7zip.sh), and drop it on your desktop. It’ll open a terminal every time you run an archive, useful for quick testing.
That’s all the steps to get 7‑Zip up and running on Debian 10 or 11. Now you can zip, unzip, and decompress everything with one tool—no more hunting down different utilities for each format.