How to package and zip files in Centos

Source: Internet
Author: User
The compressed files in linuxlinuxinclude .tar.gz,.zip,.gz. in linux, you must renew the days when .rar is absent. The following example shows how to package the full file name generated after tar-zcvf/home/files.tar.gz/filestar-zcvf is packed: package the/files folder and generate a/home/files.tar.gz file. Z

The compressed files in linuxlinuxinclude .tar.gz,.zip,.gz. in linux, you must renew the days when .rar is absent.
For details, refer to tar and zip commands.
Tar-zcvf/home/files.tar.gz/files
The full path of the file name generated after tar-zcvf is packaged to the directory to be packaged
Example: package the/files folder and generate a/home/files.tar.gz file.

Zip compression method:

Zip-r./files.zip./*-r indicates recursion.
Zip [parameter] [package file name] [package directory path]
Unzip files.zip is not explained
The basic usage of linux zip commands is:

Linux zip command parameter list:

-A converts a file to ASCII mode.
-F try to repair damaged compressed files
-H: Display the help page
-M: After compressing the file, delete the source file.

-N the specified string does not compress the file with the specified character string.
-O sets the latest change time of all files in the compressed file to the compression time.
-Q Quiet mode. the command execution process is not displayed during compression.
-R processes all subdirectories and files in the specified directory together.
-S contains system files and implicit files (S is capital)
-T date: set the last modification date of the compressed file to the specified date. The date format is mmddyyyy.

Example:

Pack all files and files in the/home/wwwroot/files/directory into the files.zip file under the current directory.

Zip-q-r files.zip/home/wwwroot/files

The preceding command compresses the files and folders of the absolute address.

For example, in the Bliux directory, you can perform the following operations to achieve the same effect.

Zip-q-r files.zip files

For example, the zip compression command in my files directory is

Zip-q-r files.zip *

The preceding operations are performed in quiet mode and contain system files and hidden files.
//////////////////////////////////////// //////////////////
Unzip syntax:

Unzip [-cflptuvz] [-agCjLMnoqsVX] [-P <密码> [[.Zip file] [file] [-d <目 录> ] [-X <文件> ] Or unzip [-Z]

Note: unzipis the decompression program for. ZIP compressed files.

Unzip parameters:
-C displays the extracted results on the screen and converts the characters properly.
-F: update an existing file.
-L displays the files contained in the compressed file.
The-p parameter is similar to the-c parameter. the decompressed result is displayed on the screen, but no conversion is performed.
-T check whether the compressed file is correct.
The-u parameter is similar to the-f parameter, but in addition to updating existing files, other files in the compressed file are also extracted to the directory.
-V displays detailed information when executing the command.
-Z only displays the remarks of the compressed file.
-A performs necessary character conversion on text files.
-B. do not convert characters in text files.
-C: The file name in the compressed file is case sensitive.
-J does not process the original directory path of the compressed file.
-L change all file names in the compressed file to lowercase letters.
-M sends the output result to the more Program for processing.
-N do not overwrite the original file during decompression.
-O does not need to ask the user first. after unzip is executed, it overwrites the original file.
-P <密码> Use the zip password option.
-No information is displayed when q is executed.
-S converts the white space characters in the file name to the bottom line characters.
-V retains the file version information of VMS.
-X: saves the original UID/GID of the file at the same time during decompression.
. ZIP file] specifies the. zip compressed file.
[File] specifies the files in the. zip compressed file to be processed.
-D <目录> Specifies the directory to be stored after the file is decompressed.
-X <文件> Specifies which files in the. zip compressed file are not processed.
-Z unzip-Z is equivalent to executing the zipinfo command.

Example:

Decompress/home/wwwroot/files.zip to the current directory.

Unzip files.zip

If this prompt is displayed:
-Bash: zip: command not found cannot perform ZIP compression because ZIP is not installed,
Run the following command to install yum install zip.

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.