Ubuntu : Zip, Unzip file using terminal.

Here is way to create zip and unzip recursively. For this, You have to install zip and unzip installation packages with following commands in terminal. Open terminal by pressing Ctrl + Alt + T.

sudo apt-get install zip  // to install zip command packages. 
sudo apt-get uninstall zip // to Unistall unzip command package.

Create a zip file :

Go To the path of that folder which you have to make zip and run following command to make a zip file.

zip -r zip-file-name.zip directory-to-compress/
  • zip :  This is the application name, which we are using to create zip file.
  • -r : For recursive
  • zip-file-name.zip : Name of result zip file name.
  • directory-to-compress/ : Name of the directory which we want to compress.

You can add more than one directory in single archives by following command :

sudo zip -r zip-file-name.zip directory-1/ directory-2/

There is no need of -r (recursive) option for single file archive.

sudo zip a2bizz.zip a2bizz.php

Unzip file

Following command will help you to unzip a file.

sudo unzip a2bizz.zip -d destination_dir/
  • sudo : super user
  • unzip : This is unzip application, which is using to extract a zip file.
  • -d : Shorts for destination
  • destination_dir/: This is the directory where you want to extract files.

You can also use unzip a2bizz.zip to extract data on same dir.

Enjoy :)