Linux command: Compression unpacking tool Large Collection

Source: Internet
Author: User
Tags bz2 file copy unpack uncompress

Directory

    • (1) Zip

Compression, decompression and archiving tools There are many, today's small series on the collation of a few people are more commonly used.

Compress gzip bzip2 XZ

Zip tar cpio

First, compression, decompression tools

          usage

 

Compact

Tool

Compressed

Compressed package format

Unzip

(The source file is not retained by default)

-C: Print compressed results to the screen

Save compressed file extract

*zcat: Print extract results to screen

Force compression (hard link is not compressed by default)

Show detailed procedure

Compression ratio

-# (the higher the number, the higher the compression ratio, the slower the

File size)

Compress

(minimum compression ratio, maximum file size)

. Z

-D

Uncompress

-C > X

(> equivalent to create file, change permissions)

Zcat x.z > X

(> equivalent to create file, change permissions)

-F

-V

No

Gaip

. gz

-D

Gunzip

-C > X

Zcat x.gz > X

-F

-V

-1--fast

-6 (default)

-9--best

. bz2

-D

Bunzip

-C > X

 

-N (permissions unchanged)

Bzcat x.gz > X

 

-K

-F

-V

-1  --fast

---best

  (default)

Xz

(maximum compression ratio, minimum file size)

. XZ

-D

-C > X

-K (Permissions not changed)

Xzcat x.gz > X

-K

-F

-V

-1--fast

-6 (default)

-9--best

( 1 ) Compress Compressed files, will delete the original files, generate compressed files

format: . Z

Unzip: - D Unzip the file, delete the compressed file, generate the original file (Cannot tab)

uncompress and-D (Can tab)

zcat x.z > X zcat x.z to print the extracted results to the screen, with redirection, to import the extracted results into. Z compressed file, the original file is not deleted, the compressed file is generated, but the permissions change because the > generates a new file.

Show Results: - c Print compressed results to the screen, with redirection, to import the compressed results into. Z compressed file, the original file is not deleted, the compressed file is generated, but the permissions change because the > generates a new file. (You can compress a file with a hard link number of 2)

Force compression:-F Default does not have a hard-link number of 2 and above file compression, plus F, forcing the compression of the specified file, and other files with the inode hard links minus 1.

Show verbose process:-V

( 2 ) gzip compress files, delete original files, generate compressed files

format: . GZ

Unzip: - D Unzip the file, delete the compressed file, generate the original file (Can tab)

Gunzip is the same as-D

zcat x.gz > X (same principle as compress)

Show Results:  - C (same principle as compress)

Force compression:-F (same principle as compress)

Show verbose process:-V

Compression ratio: The larger the -# number, the higher the compression ratio, and the slower the file size becomes.

-1 equals--fast

-2,3,4,5,6 (default defaults), 7,8

-9 equals--best

( 3 ) bzip2 compress files, delete original files, generate compressed files

format: . bz2

Unzip: - D Unzip the file, delete the compressed file, generate the original file (Can tab)

bunzip2 is the same as-D

bzcat x.bz2 > X (same principle as compress)

retain the original file compression, decompression :-K uses more than Compress,gzip

Show Results:  - C (same principle as compress)

Force compression:-F (same principle as compress)

Show verbose process:-V

Compression ratio: The larger the -# number, the higher the compression ratio, and the slower the file size becomes.

-1 equals--fast

-2,3,4,5,6,7,8

-9 equals--best (default defaults)

( 4 ) XZ Compressed file, will delete the original file, generate a compressed file

format: . XZ

Unzip: - D Unzip the file, delete the compressed file, generate the original file (Can tab)

xzcat x.gz > X (same principle as compress)

retain the original file compression, decompression :-K uses more than Compress,gzip

Show Results:  - C (same principle as compress)

Force compression:-F (same principle as compress)

Show verbose process:-V

Compression ratio: The larger the -# number, the higher the compression ratio, and the slower the file size becomes.

-1 equals--fast

-2,3,4,5,6 (default defaults), 7,8

-9 equals--best

Comparison: Compression ratios: XZ > Bzip2 > Gzip > Compress (not necessarily, some cases bzip2 better than XZ)

XZ compression Ratio max, file minimum

Second, Packaging Tools Zip tarBack to Top (1) Zip

Package compression (auto-generate suffix. zip)

①zip–r makefile (automatically generate. zip) package files (directories, normal files are OK)

Example: Zip-r app app/

②comment | Zip build file (automatically generated. zip) -

Package This way only unzip-p x.zip > X Unpacking

Example: Cat/var/log/messages | Zip messages-

Unzip-p message.zip > Message

Unpacking and decompression

Unzip X.zip

Unzip-p Preview the extracted content to the screen, you can configure the redirection to save the results to the specified file, and the permissions change.

( 2 ) Tar

- F Package name , all usages must be combined with-f

  - C -F Create Package name original file (multiple can be specified)

- T -F Package Name displays the file name in the package

-T V-F verbose display of file names in packages

- R -F package name new file name (can specify multiple), put the specified file in the package

--delete -F Package name deleted file name (multiple can be specified), remove specified files from package

- x -F Package name extracts all files to the current directory, removes all files from the package, extracts the package

- x -F Package name file name solution to the current directory, remove the specified file from the package

- C unpacking to the specified directory

- v Detailed information

-jCF creates the package's name (. Tar.xz) Original file (multiple can be specified) packaged and compressed with XZ

-jCF creates the package name (. tar.bz2) original file (can be specified multiple) packaged and compressed with bZIP

- ZCF creates the package's name (. tar.gz) Original file (multiple can be specified) packaged and compressed with gzip

- T specifies a list that contains the files that need to be packaged , separated by a newline character

- x specifies an exclusion list , with a newline character as the interval

Split–b size–d Tar-file-name prefix-name to separate the tar package into multiple files

Multiple file names separated by Cat > Single file name merge

( 3 ) cpio(not used)

The Cpio command is a redirected way of packaging a file for backup, restoring a recovery tool that can decompress files ending with ". Cpio" or ". Tar".

cpio [Options] > file name or device name

Cpio [Options] < file name or device name

Options

-o Package a file copy into a file or export the file to the device

-I unpack, unzip the package file or restore the backup on the device to the system

-T Preview, view the contents of the file or output to the file on the device

-V Displays the file name during the packaging process.

-D Unpack the directory, and automatically build the directory when Cpio restore

-C A newer storage method

Example: the ETC directory backup find./etc-print |cpio-ov >etc.cpio

Content Preview Cpio–tv < Etc.cpio

To unpack files Cpio–idv < Etc.cpio

Linux command: Compression unpacking tool Large Collection

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.