menga

creating a zip fast in linux

zip box

While true there are better archive formats such as TAR, TAR+GZIP, TAR+ZST (which I really like), 7-Zip, and others, the saving grace of ZIP is that everybody knows what it is, and it's stupidly easy to use on the Linux command line. There's also another saving grace that I'll get to in a minute.

There are only three things you ever have to remember about zip in Linux.

  1. The -r option, which means recursive, as in "zip whatever is in the directory and all subdirectories in it".
  2. zip and unzip are separate commands. For those old enough to remember (or if you're into retro computing), in MS-DOS, PKZIP and PKUNZIP were separate commands, and that's probably why zip and unzip are separate in Linux.
  3. The -d option in unzip to specify where to unzip.

How it's done

I have a bunch of WAV sounds from Windows 7 just because I like them, so that's the example I'll use for my ZIP archive.

Launch a terminal and navigate to the directory you want to make a ZIP of:

image

zip -r ~/Desktop/archive.zip *

I used the file name win7_sounds.zip for mine:

image

Press enter, and the ZIP is created directly on the desktop:

image

If I want to extract this, I use unzip.

The ZIP file is on the desktop, so I navigate there:

image

This is where the -d for unzip is used.

The next command is:

unzip -d folder_to_create archive.zip

Using my win7_sounds.zip example, I just made the directory name the same as the archive name, except without the .zip at the end since that's not necessary.

image

What this does is automatically create the folder and all the files in the zip are extracted there.

And now I have a folder created with all the files in it:

image

Why bother with ZIP? What's the point?

The answer is kind of funny.

ZIP has the most legacy support out of all archive formats. WinXP can even open a ZIP without any additional software, so it goes back that far on a native OS support level. But that's not the reason you use ZIP.

You use ZIP because it's the one archive format that works on both your computer and your phone without having to install anything.

Android is a Linux environment, meaning it should just open up a TAR or TAR+GZ on a native level with no problem at all... except on many (all?) phones, it doesn't. If you want to open up that TAR, a separate app has to be installed to open up that archive.

ZIP, on the other hand, will open right up with just a tap. No additional app needed.

And yes, it works both ways. If for example you want to put a bunch of images and/or videos from your phone into a ZIP, yeah, the phone has native support for that. Chances are very good you can just multi-select images/videos using the phone's default file manager and ta-da, an option to make a ZIP will be there.

ZIP may be ancient, but it works everywhere, and that's why you use it.

Published 2025 Aug 19