Unzip and uncompress files on a Raspberry Pi
By Russell Barnes. Posted
Files downloaded from the internet almost always arrive on your computer as compressed files. In this feature we're going to look at how to unzip (or uncompress) files on a Raspberry Pi.
Files are often compressed before being made available for transfer. The reduced file sizes are quicker to download, smaller to host, and save money on bandwidth.
Pretty much everybody is familiar with the concept of a compressed file, often called a ‘zipped’ file thanks to the early, and still popular, zip format.
Unzip files on a Raspberry Pi
Uncompressing, or ‘unzipping’ a compressed file isn’t a complicated task, but there is a baffling array of different compression techniques and files, each requiring its own tool and technique for restoring the file to its former glory.
Lets look at the different compressed file types you’ll come across when using a Raspberry Pi, and how to go about unzipping them.
STEP-01: Archiver
Your first stop for uncompressing any file on your Raspberry Pi should be to use Archiver. This lightweight desktop app, also known as Xarchiver, is included with Raspbian and can handle 7-zip, arj, bzip2, gzip, rar, lha, lzma, lzop, deb, rpm, tar, and zip archives. Open it using Menu > Accessories > Archiver.

STEP-02: Open archived files
Choose Archiver > Open or click on the ‘Open an Archive’ icon. Choose a compressed file (typically it’ll be saved in your Downloads folder) and click Open. It may take a while to scan the file, depending on its size. We’re using the RISC OS image from here as a test.

STEP-03: Select and view
Typically, you’ll want to extract all the files in a compressed image, but it’s worth knowing that you can select individual files and extract them. You can also double-click on files in the compressed image inside Archiver to view them (handy for ReadMe files).

STEP-04: Extract
The Extract Files window is straightforward. If all you want are the files, then click Extract and they’ll be saved into the same location (typically Downloads). You can change the Extract To folder, but you won’t have sudo privileges, so stick to directories inside /home/pi/. You can also enter the password to access restricted compressed files. The icon in the bottom-right corner of Archiver will flash green and red while it extracts the files, and solid green when it’s done.

Unzip, extract and uncompress files in Terminal
You may need to extract files while working from the command line. There’s a range of tools you’ll need – some are installed on the Raspberry Pi and others you’ll need to acquire with apt-get. Here are the commands you need for many popular extension types. Enter man and the file type, such as man tar, to view more information.
- File extension: .tar
tar xvf filename.tar - File extensions: .tar.gz, .tgz, .tar.bz
tar xzvf filename.tar.gz - File extension: .gz
gunzip filename.gz - File extensions: .bz, .bz2
bunzip2 filename.bz2 - File extension: .xz
unlzma filename.xz - File extension: .zip
unzip filename.zip - File extension: .7z
sudo apt-get install p7zip-full 7z x filename.7z - File extension: .rar
sudo apt-get install unrar-free
unrar x filename.rar
Russell runs Raspberry Pi Press, which includes The MagPi, Hello World, HackSpace magazine, and book projects. He’s a massive sci-fi bore.
Subscribe to Raspberry Pi Official Magazine
Save up to 37% off the cover price and get a FREE Raspberry Pi Pico 2 W with a subscription to Raspberry Pi Official Magazine.
More articles
Make your RAM go further – Raspberry Pi OS memory optimisation tips
In issue 164 of Raspberry Pi Official Magazine we have been playing around with the new Raspberry Pi 5 1GB RAM. While the RAM shortage caused by the demands of AI infrastructure is annoying beyond belief, this has been a great chance for us to really get to grips with RAM. Generating images in Stable […]
Read more →
Mighty Projects – 1GB Computer in Raspberry Pi Official Magazine 164
It’s normal for computers to get faster and more pwerful, but the new-ish Raspberry Pi 5 1GB is a step in the other direction: it has all the processing power and the same GPIO pins of its more costly siblings, but with only 1GB of RAM it’s at a price that’s friendlier on the wallet […]
Read more →
Win one of five 256GB Raspberry Pi Flash Drives
If you’ve been around long enough, you know that every Raspberry Pi accessory is top quality, and the latest Flash Drive is no different. Fancy a big one? We have five up for grabs, and you can enter below… Win 1 of 5 256GB Raspberry Pi Flash Drives
Read more →