Image: Jack Wallen

Recently, I showed you how to create compressed archives from the Linux command-line using the tar command. This time I want to demonstrate the same task, but using a tool you’re probably already familiar with. The tool in question is zip, and it creates compressed zip files from whatever you throw at it.

SEE: 5 Linux server distributions you should be using (TechRepublic Premium)

So, let’s say you have the folder TEST and you want to create the compressed file so you can send it to a colleague. Fortunately, Linux can use the zip tool, but first, you might have to install it with a command like sudo apt-get install zip -y or sudo dnf install zip -y.

Once installed, zip is ready to go. Let’s compress that TEST folder. How you create the zipped file isn’t quite as simple as you might think. The basic command is zip NAME (where NAME is the name of the folder to be compressed). However, if you simply issued the command zip TEST, you’d wind up with a file named, but after uncompressing it, you’d find it’s missing the contents.

Why? Because you only compressed the folder, not the contents.

To include the contents of the TEST folder, you’d add the recursive flag, as in zip -r TEST.

SEE: Rust: What developers need to know about this programming language (free PDF) (TechRepublic)

When you issue the command with the -r flag, you’ll see zip adds every file within the directory to the compressed file. This time, if you decompress the file, with the command unzip, the contents of the directory remain intact.

And that’s all there is to creating compressed archives from the Linux Command Line Interface, using the zip tool.

Subscribe to TechRepublic’s How To Make Tech Work on YouTube for all the latest tech advice for business pros from Jack Wallen.