Ads

Wednesday, 2 September 2015

How can I create a archive/zip of a whole directory via terminal?

Create Zip file using Ubuntu command
Create Zip file using Ubuntu command

For creating the zip you have installed zip. For installing zip execute the below command to terminal

 sudo apt-get install zip  

After the install the zip executes the below command into the terminal for creating zip files

 zip -r myfiles.zip myfiles  

-r (recursive) –r  option is zip whole directories and files trees at once

 myfiles is the directory path which needs  to convert into a zip file.

produced zip name of the zip which have the directory structure as well as the files .

You can also tell where the zip file will. Here is the example /home/ubuntu/myfiles.zip, myfiles.zip will store at home /home/ubuntu/ path.

 The zip command comes with documentation telling you about all of its (many) options; type
 man zip  
to see that documentation.