How do you zip files using SUSE Linux?

Goal:  You want to use zip when you are using SUSE (openSUSE or SUSE Linux Enterprise).  You want to use the character (or command) prompt.  You do not want to use the GUI.
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

Part 1 Installation Process
If the command cannot be found, use these commands:

sudo su -
zypper install -y zip

If you do not have access to the Internet (so a .ymp file could not help you), and your network has no .rpm package repositories configured, get the file from here:

http://software.opensuse.org/download.html?project=Archiving&package=zip

If you are using a free SUSE Linux with AWS, then your version is SLE (not openSUSE).  To find the exact version of SUSE you are using, issue this command: cat /etc/*-release
AWS SUSE servers have zip installed by default.

The buttons can be right clicked to copy the location (e.g., to use wget http://software.opensuse.org/ymp/Archiving/SLE_12_SP1/zip.ymp).  But .ymp files are only useful if your server has Internet access.  You click "Grab binary packages directly" and then download the appropriate file to your workstation and transfer it over to the Linux machine (e.g., with SFTP or SCP).    

Once you get the file over, install it with this command: zypper install /path/to/zip*rpm

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 target.zip pub.txt pub1.txt pub2.txt

The above command will create a zip file called target.zip.  The files will be compressed (that is, the .zip file will be smaller than the sum of the three .txt files).  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 *