Compress a folder (folder packaging) under Linux

Source: Internet
Author: User
Tags gz file

Tar-zcvf/home/xahot.tar.gz/xahot
TAR-ZCVF the directory to be packaged when the file name full path is generated after packaging
Example: Package the/xahot folder into a/home/xahot.tar.gz file.
Zip compression method:

Compresses the current folder Zip-r./xahot.zip./*-R means recursion
Zip [parameters] [file name after packaging] [packaged directory path]
Decompression Unzip Xahot.zip not explained
The basic usage of the Linux zip command is:

Linux zip command parameter list:

-a convert the file to ASCII mode
-F attempt to repair corrupted compressed file
-H Display Help interface
-M after compressing the file, delete the source file

-N specific string does not compress files with a specific trailing string
-O to set the latest change time for all files in the compressed file to the time of compression
-Q Quiet mode, does not show the execution of instructions during compression
-R processes all subdirectories and files in the specified directory
-S contains system files and implied files (S is uppercase)
-T date sets the last modified date of the compressed file to the specified date, and the date format is mmddyyyy

Example:

Package all files and folders under this directory as Xahot.zip in the current directory/home/wwwroot/xahot/

Zip–q–r Xahot.zip/home/wwwroot/xahot

The above command operation is to compress the absolute address files and folders. The following is a list of compression relative paths

For example, in Bliux this directory, do the following to achieve the same effect.

Zip–q–r Xahot.zip Xahot

For example, now my xahot directory, I operate the zip compression command is

Zip–q–r Xahot.zip *

The above is done in quiet mode, and contains system files and hidden files
//////////////////////////////////////////////////////////
Unzip syntax:

Unzip [-cflptuvz][-agcjlmnoqsvx][-p < password >][.zip file] [file][-d < directory >][-x < file;] or unzip [-z]

Additional note: Unzip is the unzip program for. zip compressed files.

Unzip parameters:
-C Displays the extracted results to the screen and converts the characters appropriately.
-F Updates an existing file.
-L Displays the files contained within the compressed file.
-P, similar to the-c parameter, displays the results of the decompression to the screen, but does not perform any conversions.
-T checks that the compressed file is correct.
-U is similar to the-f parameter, but in addition to updating existing files, other files in the compressed file are extracted to the directory.
-V performs yes when the detailed information is displayed.
-Z Displays only the memo text of the compressed file.
-A necessary character conversion for the text file.
-B Do not convert the text file to character.
The file names in the-C compressed file are case sensitive.
-J does not handle directory paths that are contained in compressed files.
-L Changes all the file names in the compressed file to lowercase.
-M sends the output to the more program processing.
-N Do not overwrite the original file when extracting.
-O do not need to ask the user first, unzip overwrite the original file after execution.
-p< password > password using zip option.
-Q does not display any information when executing.
-S converts white space characters in the file name to baseline characters.
-V retains the file version information for the VMS.
-X Unzip while the original uid/gid of the file is stored back.
[. zip file] Specifies a. zip compressed file.
[file] Specifies which files in the. zip archive to process.
-d< directory > Specifies the directory to be stored after the file has been decompressed.
-x< file > Specifies which files in the. zip archive are not processed.
-Z unzip-z equals execute zipinfo Instruction

Example:

Extract the/home/wwwroot/xahot.zip to the current directory

Unzip Xahot.zip

If this prompt appears:
-bash:zip:command not found cannot perform zip compression because no zip is installed,
Run this installation command to yum install zip

Compress a folder (folder packaging) under Linux

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.