Cyberithub

zip command not found error in Linux (RedHat/CentOS 7/8)

Advertisements

In this article, we will look into zip command not found error in Linux (RedHat/CentOS 7/8). Many times you might have observed "zip command not found" error while trying to compress files using zip command in Linux. This is because zip command will not be available by default. You need to separately install it using below given steps.

zip command is widely used in both Unix and Linux Based systems to reduce the total file size by compressing them. There are other tools that can be used for compression which i will cover in later articles. In this session, we will keep our focus on "zip command not found" error.

zip command not found error in Linux (RedHat/CentOS 7/8) 1

zip command not found error in Linux

Also Read: Understanding Kafka Console Producer and Consumer in 10 Easy Steps

Step 1: Prerequisites

a)You need to have a running RedHat/CentOS 7/8 System

b)System should have yum command installed.

c)You need to have sudo access to run all privileged commands.

NOTE:

Please note that here I am using root user to run all the below commands. You can use any user with sudo access to run all these commands. For more information, Please check Step by Step: How to add User to Sudoers to provide sudo access to the User.

Step 2: Update Your System

Before installing zip package you need to first update all the packages to the latest version using yum update -y command as shown below. In this example since system is already updated with latest version so it does not have any new updates to install.

[root@localhost ~]# yum update -y
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
* base: mirrors.piconets.webwerks.in
* epel: mirrors.piconets.webwerks.in
* extras: mirrors.piconets.webwerks.in
* updates: mirrors.piconets.webwerks.in
No packages marked for update

Step 3: Install zip command

After updating all the packages it is now time to install zip package using yum install zip -y command as shown below.

[root@localhost ~]# yum install zip -y
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
* base: mirrors.piconets.webwerks.in
* epel: mirrors.aliyun.com
* extras: mirrors.piconets.webwerks.in
* updates: mirrors.piconets.webwerks.in
Resolving Dependencies
--> Running transaction check
---> Package zip.x86_64 0:3.0-11.el7 will be installed
--> Finished Dependency Resolution

Dependencies Resolved

========================================================================================================================================================================
Package Arch Version Repository Size
========================================================================================================================================================================
Installing:
zip x86_64 3.0-11.el7 base 260 k

Transaction Summary
========================================================================================================================================================================
Install 1 Package

Total download size: 260 k
Installed size: 796 k
Downloading packages:
zip-3.0-11.el7.x86_64.rpm | 260 kB 00:00:00
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
Installing : zip-3.0-11.el7.x86_64 1/1
Verifying : zip-3.0-11.el7.x86_64 1/1

Installed:
zip.x86_64 0:3.0-11.el7

Complete!

Step 4: Verify Package Installation

After successful installation of zip package, you can query the rpm db and verify the installation using rpm command as shown below.

[root@localhost ~]# rpm -qa | grep -i zip
gzip-1.5-10.el7.x86_64
zip-3.0-11.el7.x86_64
bzip2-libs-1.0.6-13.el7.x86_64

Step 5: Test zip command

After successful installation of zip package you can check the zip command usage by compressing a simple file.txt file to file.zip format as shown below.

[root@localhost ~]# zip file.zip file.txt
adding: file.txt (deflated 63%)

You can check other zip commands option using zip --help command as shown below.

[root@localhost ~]# zip --help
Copyright (c) 1990-2008 Info-ZIP - Type 'zip "-L"' for software license.
Zip 3.0 (July 5th 2008). Usage:
zip [-options] [-b path] [-t mmddyyyy] [-n suffixes] [zipfile list] [-xi list]
The default action is to add or replace zipfile entries from list, which
can include the special name - to compress standard input.
If zipfile and list are omitted, zip compresses stdin to stdout.
-f freshen: only changed files       -u update: only changed or new files
-d delete entries in zipfile         -m move into zipfile (delete OS files)
-r recurse into directories          -j junk (don't record) directory names
-0 store only                        -l convert LF to CR LF (-ll CR LF to LF)
-1 compress faster                   -9 compress better
-q quiet operation                   -v verbose operation/print version info
-c add one-line comments             -z add zipfile comment
-@ read names from stdin             -o make zipfile as old as latest entry
-x exclude the following names       -i include only the following names
-F fix zipfile (-FF try harder)      -D do not add directory entries
-A adjust self-extracting exe        -J junk zipfile prefix (unzipsfx)
-T test zipfile integrity            -X eXclude eXtra file attributes
-y store symbolic links as the link 
   instead of the referenced file
-e encrypt -n don't compress these suffixes
-h2 show more help

 

I hope you liked this article on "zip command not found" error. Please let me know your feedback on Comment Box.

 

Popular Recommendations:-

Kickstart post install script examples in RedHat/CentOS 7/8

How to Enable or Disable SELinux Temporarily or Permanently on RedHat/CentOS 7/8

10 Popular Examples of sudo command in Linux(RedHat/CentOS 7/8)

Popular Apache Kafka Architecture Explained Using 4 Basic Components

12 Most Popular rm command in Linux with Examples

Create a Self Signed Certificate using OpenSSL

Leave a Comment