"Linux" Linux in Zip and unzip

Source: Internet
Author: User
Tags zip archive file

One, zip compression

1, Application examples

(1) package all the files under the current folder into one Xxx.zip file

    Zipxxx.zip *

(2) package all. doc files in the current folder into a single xxx.zip file

Zipxxx.zip *.doc

(3) Compress a file xxx.txt and a directory dir1 into @.zip

Zip-r @.zipxxx.txt Dir1

(4)/111/222/333/all files and folders under this directory as @.zip in the current directory

    Zip-r @.zip/111/222/333

    ZIP-QR @.zip/111/222/333

Note:-Q is quiet mode and does not show the execution of instructions during compression

(5) Add a file to the @. zip

    Zip-g @.zip ***.doc

Note: If you did not press ***.doc in the @.zip, add it now.

The-G option is meant to increase without re-producing.

(6) Add the changed ***.doc file to the @.zip compact package

Zip-u @.zip ***.doc

(7) Delete the specified A.doc file in addition to the @. zip file

    zip-d @.zip A.doc

Note: If A.doc was a file that was compressed in @.zip, the command now removes it from the compressed file and deletes it. -D is the meaning of the deletion.

2, main parameters

    • -F Updating an existing file
    • -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
    • -d Specifies the directory to be stored after the file has been decompressed
    • -M compresses the file and joins the compressed file, deletes the original file, then moves the file to the compressed file
    • -R processes all subdirectories and files in the specified directory
    • -J does not handle directory paths in compressed files
    • -0 storage only, no compression
    • -l display files contained within a compressed file
    • -1 Faster compression
    • -9 Higher quality compression
    • -Q Quiet mode, does not show the execution of instructions during compression
    • -V displays detailed information when executing
    • -C Display the extracted results to the screen and convert the characters appropriately
    • -Z Show only notes text for compressed files
    • [email protected] read the name from standard input, one line for the path name
    • -O to set the latest change time for all files in the compressed file to the time of compression
    • -x specifies that you do not process which files in the. zip archive
    • -I only compress files that match the criteria
    • -F attempt to repair corrupted compressed file
    • -D does not establish directory names in compressed files
    • -A adjust the executable auto-unzip file
    • -j Delete executable file, leave a normal zip archive file
    • -T checks that each file within the backup file is correct
    • -X unzip while back to file the original Uid/gid
    • -Y saves the symbolic connection directly, not the file that the connection points to, and this parameter is valid only on systems such as UNIX
    • -E Encryption
    • -n Do not compress files with a specific trailing string
    • -H2 Show More help

Second, unzip decompression

1, Application examples

(1) Extract the files into the current directory

    Unzip Test.zip

(2) If you want to extract the files to the specified directory, you need to use the-D parameter.

    Unzip mydata.zip-d Mydatabak

(3) When extracting, sometimes do not want to overwrite the existing file, then you can add the-n parameter

    Unzip-n Test.zip
Unzip-n-d/temp Test.zip

(4) Extract the compressed file Test.zip in the specified directory TMP, if the same file exists, requires the unzip command to overwrite the original file

    Unzip-o test.zip-d/tmp/

(5) Just look at what files are included in the ZIP archive and do not unzip

Unzip-l Test.zip

(6) Check the files in the A.zip compressed package, and also include the compression ratio
    Unzip-v a.zip "This command contains the contents of (5), in more detail"

(7) Check if the files in the A.zip are damaged
    Unzip-t A.zip

(8) Unzip all the files inside the/home directory under Wwwroot.zip to the first level directory
  
Unzip-j Wwwroot.zip

(9) Extract the Abc12.zip, Abc23.zip and Abc34.zip from the/home directory into the/home directory

Unzip Abc*.zip

2, main parameters

      • -C Display the extracted results to the screen and convert the characters appropriately
      • -P, similar to the-c parameter, displays the results of the decompression to the screen, but does not perform any conversions.
      • -l display files contained within a compressed file
      • -F Updating an existing file
      • -T checks if the compressed file is correct, but does not
      • -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
      • -Z Show only notes text for compressed files
      • -V displays detailed information when executed. or view the compressed files directory, but do not press
      • -T sets the latest change time for all files in the compressed file to the time of decompression
      • -x specifies that you do not process which files in the. zip archive
      • -d Specifies the directory to be stored after the file has been decompressed
      • -N Do not overwrite the original file when extracting
      • -Q Quiet mode, does not display any information when executing
      • -O do not need to ask the user first, unzip overwrite the original file after execution
      • -A necessary character conversion for a text file
      • -J does not handle directory paths in compressed files
      • -AA all file directories as text processing
      • -U use escapes for all Non-ascii Unicode
      • -uu ignoring Unicode encoded characters
      • The file names in the-C compressed file are case-sensitive
      • -L Change all the file names in the compressed file to lowercase
      • -X unzip while back to file the original Uid/gid
      • -V Keep the file version information of the VMS
      • -K reserved file's Setuid/setgid/tacky property
      • -M sends output results to more program processing
      • -o Specifies character encoding dos,windows and OS/2
      • -i specifies character encoding for UNIX

"Linux" Linux in Zip and unzip

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.