If you want to transfer files to another person, one of the best ways to do that is through a zip file. Not only is it a single file that's easily transferred (versus sending a whole folder), it often makes files smaller thanks to compression, as well. if you're new to Linux, then you're probably wondering how you can zip your files to transfer to someone else. Thankfully, it's easy, and we'll show you how.

👁 Ubuntu logo.
What is Ubuntu? The ins and outs of one of the most popular Linux distros

When it comes to Linux, one of its most mainstream implementations is Ubuntu. Here's everything you need to know.

How to zip and unzip files on Ubuntu using the command line

There's no need to be afraid of the terminal

The best and easiest way to do anything in Linux is with the terminal, and Ubuntu is no different!

  1. Open the Terminal by searching for it in your application list or press Ctrl+Alt+T
  2. Type cd to view your current folder
  3. Use cd to navigate to the folder that contains the files or directories that you want to zip or unzip. You can find this by viewing the properties of the files or directories you want to zip. In the above case, you would type cd /home/adam/Documents
  4. To zip it and other files after you have used cd to navigate to the folder, do the following: zip -r filename.zip directory1 directory2 file1 file2 You can add as many files and folders as you want, but if you're zipping folders, make sure to use the -r flag. This recursively zips the folder's contents.

Note that the syntax is that the filename you want to save into comes first. This is a common error people make, so ensure that your zip file is first.

To unzip zip files on Ubuntu in the Terminal, do all of the same steps, but instead, do:

  • unzip filename.zip

If you want to unzip to a specific directory, then do:

  • unzip filename.zip -d directory

If you do not have unzip installed, you can execute:

sudo apt-get install unzip

and then the command will work.

How to zip and unzip files on Ubuntu using the GUI

Nautilus is Ubuntu's default file manager

To zip files in the GUI on Ubuntu is really easy, too.

  1. Open Nautilus, called Files in your applications list
  2. Navigate to the folder containing what you want to zip. Select multiple files at a time by either press control and clicking each item individually, or by clicking and dragging to highlight them.
  3. Right click and select compress
  4. Name your archive, and click Create
  5. To unzip it, you can right click the file and click Extract to or Extract here.

That's it! You've now created a zip file on Linux that you can then unzip as well.