• Skip to primary navigation
  • Skip to main content
  • Skip to primary sidebar
sharadchhetri

sharadchhetri

Tutorials On Linux, Unix & Open Source

  • Home
  • Linux Commands
  • Resources
    • Learn Linux
  • My WordPress plugins

How to zip the directory in linux with command line

March 28, 2013 by Sharad Chhetri 3 Comments

In this tutorial we will learn,how to zip the directory in linux with command line.Zip is a compression and file packaging utility for Linux,Unix,Windows and various Operating system. The zip helps to compress and reduce the size of file and directory.To zip a directory,first of all we will check ,do we have zip command installed in Linux system.

Note: For more detailed zip examples with command line, read out this post (How to zip directory in linux explained with examples).

The below command will help to find is zip installed or not.

# which zip   (It will show the absolute path of zip)

In CentOS

# rpm -q zip

In Debian or Ubuntu

$ sudo dpkg -l zip

If you find it is not installed in system then install with given below command.

In CentOS or Red hat
# yum install zip

In Debian or Ubuntu
$ sudo apt-get install zip

After confirmation of installed zip package,now we will zip or compress the directory in Linux system.
Use the given below command.

zip -r GiveAnyName.zip  /path/of/Directory

for eg.
 We have a backup directory in /root/ (i.e /root/backup)

zip -r backup.zip /root/backup

The command will compress the directory with extension .zip .
In above given eg. the compressed file name would be backup.zip

Share this:

  • Twitter
  • Facebook
  • More
  • Print
  • Email
  • LinkedIn
  • Reddit
  • Tumblr
  • Pinterest
  • Pocket
  • Telegram
  • WhatsApp
  • Mastodon

Related posts:

  1. How to zip directory in linux explained with examples
  2. shell-init: error retrieving current directory: getcwd: cannot access parent directories: No such file or directory
  3. Linux command : To create new directory/folder
  4. Eject Command: Eject DVD-ROM Or CD-ROM In Linux
  5. Convert video file into gif file through command line in linux
  6. create iso image of directory in linux
  7. How to rename and move the directory and files in linux
  8. SCP file and directory in linux and Unix like operating system
  9. print working directory ( pwd , PWD , OLDPWD ) in Linux / Unix
  10. How to show line numbers with less command in Linux

Filed Under: Linux, Tips And Tricks Tagged With: zip

Reader Interactions

Comments

  1. Viktor says

    February 16, 2014 at 8:22 pm

    Thank you for shared this!

    I needed that with my Centos 5.9.

    Reply
    • sharad chhetri says

      February 17, 2014 at 4:06 am

      Welcome Viktor,

      I have updated the zip commands example in our new post.For further reading, her is the URL https://sharadchhetri.com/2013/10/18/how-to-zip-directory-in-linux-explained-with-examples/

      Reply
      • Viktor says

        February 17, 2014 at 9:15 pm

        Ok, I had not seen it, I’ll take a look.

        Reply

Leave a Reply Cancel reply

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

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Primary Sidebar

Our Social Media Presence

  • Facebook
  • GitHub
  • Twitter

Linux Command

What is Linux Internal And External Command

Linux Basic Commands With Examples For Every Beginner

tr command to convert lines to space , tab and vertical tab

smbpasswd command not found on CentOS 7 and RHEL 7

Solution : semanage command not found

Unix / Linux : How to print duplicate lines from file

More Posts from this Category

You Might Like These Articles!

simplecodesyntax wordpress plugin

SimpleCodeSyntax : My Another WordPress Plugin

Install Nginx

How To Install Nginx On Ubuntu 22.04 LTS

Install Latest Git package in Ubuntu Operating System

How To Always Install Latest Git Package In Ubuntu Operating System

Bash script for installing VirtualBox on Ubuntu 22.04 LTS Desktop

Install VirtualBox On Ubuntu 22.04 LTS Desktop (Bash Script)

libfuse

dlopen(): error loading libfuse.so.2 – Got Error On Ubuntu

Failed to open/create the internal network

VirtualBox Error: Failed to open/create the internal network

Always Useful Tips And Tricks

Yum Error database disk image is malformed

Print double hyphen sign simultaneously in post of Octopress

Non interactive ,without typing password do ssh to Server : By sshpass

Could not find make anywhere!!! Please edit the config section to include the path to make. at ./install.pl line 2101

How to install korn shell ksh in Linux

Virtual Machine inaccessible status on VirtualBox 4.3

How to encode and decode the strings with base64

Explore 90+ Article On "Linux Tips And Tricks"

Copyright © 2023 ยท
The material in this site cannot be republished either online or offline, without our permission.
Proudly Blogging From Bharat.

  • Contact
  • About Me
  • My WordPress plugins
  • Privacy Policy