How to unzip .7z files on Raspberry Pi

Archives, zips, compressed files… They’re a very useful invention that feature everywhere in computing. Most modern computers can decompress many of these file types without any additional software, and the Raspberry Pi is no exception… Until it comes to 7-zip files (.7z).

Luckily there’s an easy command-line tool available for this purpose. Here’s how to get it running.

This process was tested on a Raspberry Pi 3B running Raspbian Bullseye. However, it should work on most – if not all – versions of Pi and Raspbian/Debian.

1. Get to the terminal

We’ve got options here. We can get in via SSH, or directly on the Pi using CTRL+ALT+T or clicking on the terminal shortcut in the toolbar (or Menu (in the top-left) > Accessories > Terminal). Either way, you should see a prompt similar to pi@raspberrypi:~ $ (where pi is the user and raspberrypi is the hostname).

2. Update package information

To ensure our package info is up-to-date, we can run sudo apt update. sudo is short for ‘super user do’ and gives us the privileges to run this command as a super user. apt is the Advanced Packaging Tool, and update is what we want apt to do. This should only take a minute.

3. Install p7zip

Now we can run sudo apt install p7zip-full. install tells apt to look for the p7zip-full package and actually install it. Apt will confirm that we want to install. Type Y and press enter.

4. Usage

p7zip usage is simple. To run the program requires only typing 7z. This should list options and commands if p7zip is installed properly.

  • To list files inside an archive, run 7z l <file> (where <file> is the relative path to your .7z archive)
  • To extract to the current directory, run 7z e <file>
  • To extract to the current directory while respecting full paths, run 7z x <file>
  • And to specify the extraction directory, add -o<path> at the end of the command. Note that there is no space between -o and the file path.

And that’s the basics on p7zip. Enjoy your Raspberry Pi 🙂