Compression decompression of Linux file management

Source: Internet
Author: User
Tags uncompress

The compressed format of files in Linux is *.gz/*.bz2/*.xz/*.zip/*. Z, respectively, by Gzip, bZIP, XZ, zip, compress command compression obtained by gunzip/gzip-d, bunzip/bzip-d, xzdec/xz-d, unzip, uncompress decompression. *. Z or *.GZ/*.BZ2/*.XZ can use Zcat, bzcat, Xzcat command to view the contents of files in the compressed file without pressure.

Tar can implement file archiving similar to Cpio.


1.gzip:*.gz

gzip [-acdfhllnnrtvv#] [-s suffix] [name ...]

                     gzip–c filename > Filename.gz  compress Keep source file, default compress delete original file
          -d--decompress--uncompress: Extract

- R or--recursive: recursive processing

- V or--verbose: Show instruction execution Process

-#: (1-9) specify compression ratio, default is 6

Gunzip [-ACFHLLNNRTVV] [-s suffix] [name.gz ...]

gunzip–c filename.gz > FileName linux extract preserves source files, delete original files by default

Zcat [-FHLV] [name.gz ...] : View the contents of a file directly without being uncompressed


2.BZIP2: *.bz2----compression tool with a greater compression ratio than gzip, similar in usage

bzip2 [-cdfkqstvzvl123456789] [filenames ...] Delete the original file after the default compression

-D: Unzip

-C: Compression does not delete the original file, printed on the standard output

-#: (1-9) specify compression ratio, default is 6

-K: Compression is reserved for the original file

BUNZIP2 [-FKVSVL] [filenames.bz ...]

Delete original files after decompression

Bzcat [-S] [filenames ...]

View the contents of a file without decompressing

Bzip2recover filename: Recovering from a corrupted *.bz2


3.XZ:. XZ

XZ [option] ... [File] ...

-D: Uncompressed (equivalent to UNXZ)

-#: (1-9) specify compression ratio, default is 6

-K: Compression is reserved for the original file

Xzdec

-K: Keep the original file and print it to the screen


4.zip

Zip [[email protected]$] [--longoption ...] [-B Path] [-N suffixes] [-T Date] [-tt Date] [ZipFile [File ...]] [-xi List]

Common format: Zip file.zip fiel1 file2 ....

Zip tool can compress the directory, the above bZIP, GZIP2, XZ are not compressed directory, zip is first archived and then compressed, and compression is small, compression does not delete the original file.


5.tar [OPTION ...] [FILE] ... Generate *.tar Type file

- C: Create an archive file

-F File.tar Operation archive file

- x: Expand Archive

--xattrs: Preserves extended attribute information for files when archiving

- T: Directly view archived files without expanding the archive

-ZCF: Archive and invoke gzip compression

-ZXF: Call gzip to unzip and expand archive

-JCF: Archive and call bzip2 compression

-JXF: Call bzip2 to unzip and expand archive

-JCF: Archive and invoke XZ compression

-JXF: Call XZ to unzip and expand archive

-z/j/j option can be omitted, will automatically set the compression format, call the appropriate decompression tool decompression


This article is from the "A-filled blog" blog, please be sure to keep this source http://laizetian.blog.51cto.com/10728827/1700343

Compression decompression of Linux file management

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.