Command Line2 zip and unzip, line2unzip

Source: Internet
Author: User

Command Line2 zip and unzip, line2unzip
Command Line-ZIP 1. know zip

You can use man zip to obtain the man page of the zip command. The zip command can be used to compress the package file. The compressed file ends with. zip.

man zip

2. Zip Parameters
zip [-options] [-b path] [-t mmddyyyy] [-n suffixes] [zipfile list] [-xi list]
Parameters Description
-F Replace files in the compressed package with new files
-U Update only changed files and new files
-D Remove a file from a. zip package
-M Move a specific file into a zip package and delete it.
-R Recursive compression contains its subdirectories
-J Store only file names, excluding files in the directory
-Z Add annotation for zip package
-0 Store files without compression
-1 Fastest compression, worst compression rate
-9 Slowest compression,
-Q Quiet Mode, No prompts or messages are displayed
-V Displays version consultation or details
-C Add a line of comment for the newly added or updated file
-Z Add annotation for the compressed package
-@ Read File name from standard input
-O Set the compressed package time to the time when the zip file is last modified.
-X Files that do not need to be compressed
-I Specify specific files to be included
-F Repair damaged compressed files
-D Do not store file directory information in compressed files
- Adjust the executable automatic decompression File
-J Delete unnecessary numbers before a compressed file
-T Check whether each file in the backup file is correct
-X Do not save additional file Properties
-Y Directly Save the symbolic connection, rather than the file to which the connection points (this parameter is only valid in UNIX and other systems)
-E Encrypt the compressed file
-N Files with a specified extension are not compressed.
-H2 Show more help information
Use a san.zip instance

1. compress the current directory file

Format: zip-r <compressed package name> ./*

For example

zip -r test1.zip ./*

Compress all files and folders in the current directory into test1.zip files.-r indicates recursively compressing all files in the subdirectory.

2. Compress directory files

Format: zip-r <compressed package name> directory to be compressed /*

Instance

zip test2.zip test/*

3. Delete the specified file in the compressed package

Format: zip-d <compressed package name> <compressed package name list to be deleted>

Instance

 zip -d test.zip test/zip_test.txt

4. Add the specified file to the compressed package

Format: zip-m <compressed package name> <compressed package name list to be added>

Instance

zip -m test.zip test.txt

Added

Command Line-UNZIP 1. Learn about unzip

You can use man unzip to obtain the man page of The unzip command. The unzip command can be used to list, test, and extract compressed files in the zip file.

man unzip 

Ii. unzip Parameters
unzip [-Z] [-opts[modifiers]] file[.zip] [list] [-x xlist] [-d exdir]
Parameters Description
-P Similar to the-c option, the extracted results are displayed on the screen without any conversion.
-L Displays the files contained in the compressed file.
-F Update existing files
-T Check whether the compressed file is correct but not pressure-free
-U Similar to the-f option, but in addition to updating existing files, other files in the compressed file will be decompressed to the directory.
-Z Only show remarks of compressed files
-V Detailed information is displayed during execution or the compressed file directory is viewed, but the pressure is not solved.
-T Update the decompressed file time to the latest modification time.
-X Decompress the file list, but does not include the specified file.
-D Directory to remove the compressed file to the specified directory
-N Do not overwrite the original file during decompression
-Q No information is displayed during execution.
-O It is not necessary to first ask the user whether to overwrite the original file after unzip execution.
- Necessary character conversion for text files
-J Do not compress the original directory path of the file
-U Escape all non-ASCII Unicode characters
-C Names of compressed files are case sensitive.
-L Change all file names in the compressed file to lowercase.
-X During decompression, keep the original UID/GID of the file
-V Retain VMS file version information
-M Send the output result to more program for processing
3. unzip application instance

1. decompress the compressed file to the current directory.

If a file with the same name exists in the current directory, will you ask if you want to replace it?

Format: unzip

unzip test1.zip

2. The original file is not overwritten during decompression.

Format: unzip-n

unzip -n test1.zip

3. overwrite the original file during decompression

Format: unzip-o

unzip -o test1.zip

4. decompress the compressed file to the specified directory.

Format: unzip-n

unzip -n test.zip -d /home/trsky/test1

5. view the directory of the compressed package files without any pressure

Format: unzip-v

unzip -v test.zip

Zip & unzip more advanced usage

1. Compress a file file.txt and a directory into a package.zip package.

zip -r package.zip file.txt directory

2. The current directory contains the compressed package1.zip packages package2.zip1_package3.zip and package ?. Zip and decompress them together

unzip package?.zip

3. The current directory contains filepkg1, filepkg2, filepkg3, and filepkg ?, And want to compress them together to the same package package.zip

zip package.zip filepkg?

Instance

Note:? Represents a single character. If "*" is used, it indicates any number of characters.

4. Check whether the compressed file package.zip is complete.

unzip -t package.zip

5. decompress the package.zip directory files of the compressed package to the first-level file instead of creating a directory.

unzip -j package.zip

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.