Wednesday, September 3, 2014

[Quick Tips] : How to zip directory in linux explained with examples

How to zip directory in linux explained with examples

Zip is command in linux is used for compressing files and directory.In this post we will learn how to zip the directory or folder in linux.
To compress directory use the below given format
example:
To compress better and faster
To compress directory faster and better we can use the option -9 for better compress and -1 for faster.
example:
To zip multiple directory
You can also zip the directory by given below format
example:
In given below example,here I gave file name as twodir.zip and I am compressing two different directory called
testdir and teamviewer8

How to unzip

To decompress or unzip the .zip format file,you have to use simple command called unzip
Format:
example:

How to list items inside zipped file

This command is useful when you want to only see the listed items inside zipped file without decompressing it.
Format:
example:

how to test zipped file

It is good to test the file before unzip, doing test give you two advantages first you got a health check of zipped file and second you also got to know the list of directory and file inside zipped file without extracting.
To test the zip file use the option -t in given below format
format:
Example:

No comments: