/ factorpad.com / tech / linux-essentials / zip-command.html
An ad-free and cookie-free website.
Beginner
Learn to compress and archive files at the Linux command line.
Videos can also be accessed from the Linux Essentials Playlist on YouTube.
Linux zip Command Summary with Examples (3:50)
Our seventy-second word, or command to memorize is
zip
from our category
Files.
zip
allows you to compress and
archive files.
-options | description |
---|---|
-h ,
--help |
Print help screen |
-r ,
--recursive |
Include directories and files recursively |
Recall from the last four videos, we've been evaluating ways to compress files and now we'll shift to archiving, or packaging both files and directories, while compressing at the same time.
Before we start, it helps to think of commands as mini programs and
most follow this structure:
command -option(s) argument(s)
.
The zip
command has
over 30 options and the arguments include the output
file, in .zip format and the input files and
directories.
Like most commands, help is available with double-dash
--help
, and
-r
is the recursive option required
to include directories and files.
So why is zip
an important command?
Well, in order to share .zip files, a standard for
many Microsoft Windows and Mac users, you need to know how to pack
and unpack them.
And now you know how to do that.
Okay, the best way to embed this in your memory is by typing in your own terminal window.
Find this on your Mac using a program called Terminal. On Linux use Terminal or Konsole, and currently Microsoft is adding this functionality to Windows.
Here we go. First, let's use
mkdir
to create a directory called
video72
and redirect to it, the long
but helpful man
pages of the command
zip
to
video72a.txt
and
unzip
to
video72b.txt
.
And then let's to an ls
of that
directory to make sure the files are in there.
Next, let's zip the directory using
zip -r
, the destination
video72.zip
and the directory
video72
.
And see, the three actions, followed by
ls -og video72*
.
And it shows the zip and contents.
And last, let's decompress using
unzip video72.zip
.
And then it asks for multiple options here so hit capital
A
for All.
Then ls
the
video72
directory to see the two
files.
Okay now you know how to use zip
.
And you know the syntax for commands, options and arguments.
One last tip about the zip
command. So now that you have two helpful
man
pages, please review them because
they include many helpful examples for this very versatile program.
Okay, thanks for visiting today. I hope this was a helpful
introduction to the zip
command.
For an overview of the 100 videos, the 8 quizzes, a cheat sheet, the categories and a Q&A section, visit:
Please, if you found value here, return the favor, tell a friend, subscribe, follow, or give. It all helps to keep the free content flowing.
xz
command,
hit Back.tar
command, click Next./ factorpad.com / tech / linux-essentials / zip-command.html
A newly-updated free resource. Connect and refer a friend today.