How Do You Zip Files Using Ubuntu Linux From The Command Line Interface?

Goal:  You want to use zip with Ubuntu Linux without using the GUI.  You want to use the character prompt exclusively.

Background:  The zip character-based utility is useful for many reasons.  At the command line you can free up space while retaining files for future usage.  Try this command to see if zip is installed: man zip

Try this command to see if zip is installed: man zip

Part 1: Installing Zip
If the command cannot be found, use this command:

sudo apt-get install zip

If you do not have access to the Internet, and your network has no Debian package repositories configured, get the file from here:

To find the correct installation media (and choose the correct link from the website above), you need to determine the architecture.  To do this, use this command: dpkg --print-architecture

Once you get the file over, install it with this command: dpkg -i zip.*.deb

Part 2  How to Use Zip
Now that zip is installed, you can use it with a command like this (assuming you have three regular files named pub.txt, pub1.txt, pub2.txt):

zip pub.txt pub1.txt pub2.txt

The above command will create a zip file called  The files will be compressed (that is, the .zip file will be smaller than the sum of the three .txt files' sizes).  This can help reduce disk I/O when fetching the file, moving it around, and reduce network congestion with fewer packets over the network when it is in transit.

Leave a comment

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