Skip to content

Zip & Unzip Files in Ubuntu Using Command Line & GUI (How to)

Ubuntu and other Linux desktops generally ship with powerful file managers. Unlike some other operating systems, Ubuntu can handle zip archives as well as tar and other packaging formats out of the box. This is, of course, handy since you’ll be dealing with a lot of archives and zip files on Linux. Zipping and unzipping files is a very common practice in almost any field of work or even if you’re a student. Ubuntu makes life much easier. You can zip and unzip files in Ubuntu Linux using the command line. If you’re not comfortable with that, a simple right-click is also very useful.

Besides, there are a number of commands that can help you do amazing things. Do not forget to check out these 20 useful commands for Ubuntu.

Steps to Zip & Unzip Files using Command Line

Zipping and unzipping files is easy on Ubuntu because the necessary tools are already pre-installed. If for some reason, the zip unzip tool isn’t installed, you can run the following command in a terminal to manually install it.

sudo apt install zip unzip

You can also use the command if you’re unsure. If the tool is already installed, no changes will be made to your system and nothing will be installed.

Zip files in Ubuntu Using Command

To zip a file, first, make sure all the files are in the same location where your terminal window is open. After that, you just need a single command containing the name of the zip file and the files you want to zip.

files on desktop

For example have 3 files on the desktop named filename1, filename2, and filename3. To zip them, open a terminal window in the desktop folder.

zip files in Ubuntu

zip zipfilename filename1 filename2 filename3 filename4 ... filenameN

Make sure you enter all the filenames correctly. You should be able to see the zip file with the file explorer now if you wish.

zipped files on desktop

You can also zip folders or a mix of files and folders together using the same command. Instead of the filename you just have to use the folder name.

Unzip files in Ubuntu Using Command

Similarly, you can unzip any zip file by simply passing its name along with the unzip command. The files are extracted into the same location where the zip file is located. For this example, we had earlier created a file containing the three files filename1, filename2, and filename3. So the unzip command would be as following.


unzip files in Ubuntu Linux

The zip and unzip command remains the same across any other Linux distro. The only requirement is that you have the zip unzip command line tool installed on your Linux system.

Steps to Zip & Unzip Files from File Explorer (GUI)

Zipping and unzipping files via the command line is really easy on Ubuntu. But doing so via the default Nautilus file manager is even easier. Alternatively, you can also try Dolphin File Manager on Ubuntu.

Zip files

compress files ubuntu

The first thing you need to do is open the file explorer and head to the location of the files that you want to zip. Next, select all the files and then right-click on one of them. In the context menu, click on the Compress… option.

create zip archive

As soon as you click it, a popup dialog will open up. It will allow you to select from the three most popular archive formats used by Linux users. zip is selected by default so you don’t need to worry about that. It will also let you give a name to the zip file. Once you’ve given a desirable name to the zip file just click the Create button.

Unzip files

As usual, use the file explorer to navigate to the zip file that you want to unzip. Right-click on it and select either the Extract Here or Extract to… option. Extract Here will create a folder with the same name as that of the zip file, in the same location as the zip file. All the files inside the zip will then be extracted in this folder. If you choose Extract to… you will be asked to navigate to a location that you want the files extracted to.

unzip or extract file in ubuntu

You can also unzip several archives at once by selecting all of them before right-clicking on one of them. The method to zip or unzip an archive remains the same for any other kind of archive format including .tar, .tar.xz, .7zip and even .rar files.

Having learned to zip and unzip files using a command line and file explorer, you should also check out our guide on changing Ubunto desktop wallpapers automatically.

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.