zip and unzip command in linux

Here, I have described about zip & unzip commands in Linux environment. Please look on the given below zip command.

Zip Command:

$ zip option zip-filename directory-path-or-file-name

Example:

1- Create a zip of single file.

$ zip file.zip file-name

2- Create a zip of directory of files.

$ zip -r directory.zip directory-path

3- Create a zip by excluding some specific directory & sub-directory.

$ zip  -r  directory.zip  directory-path  -x exclude-dir1/**\*  exclude-dir2/**\*

4- Create password protected zip.

$ zip -p password file-name.zip file-name

Unzip command:

$ unzip zip-file-name.zip

1- Extract a ZIP File into a Different Directory.

$ unzip zip-file-name.zip -d directory-path

2- Show Content of zip file.

$ unzip -l zip-file-name.zip

3- Check zip is valid or  not.

$ unzip -t zip-file-name.zip

4- Extract password protected zip file.

$ unzip -P password zip-file-name.zip

Leave a Reply

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