File compression and decompression, File compression and decompression

Source: Internet
Author: User

File compression and decompression, File compression and decompression

File compression and decompression

Common commands and Parameters

1 gzip

-C: output the compressed or decompressed results to the standard output.

-D decompression, equivalent to guzip

-# (1-9) specifies the compression ratio. The default value is 6.

View the file without zcat decompression.

Compression: gzip FileName

Decompress: gzip-d FileName.gz

2 bzip2

-D decompression, equivalent to bunzip

-K: Retain the original file

-# (1-9) specifies the compression ratio. The default value is 6.

View the file without decompressing bzcat.

Compression: bzip2 FileName

Decompress 1: bzip2-d FileName.bz2

Decompress 2: bunzip2 FileName.bz2

3 xz

A compression command to replace gzip and bzip2

-D Decompression

-K: Retain the original file

-# (1-9) Specify the compression ratio.

View files without decompression of xzcat

Compression: xz Fileanme

Decompress: xz-d Filename. xz

The preceding three common compression commands gzip, bzip2, and xz are used with the same parameters. Remember, you can easily get started with either of them.

4 tar

Packaging tool to package multiple directories into one file. It does not support compression.

-C. Create a package file

-F specifies the package file name (-f must be put together with the file name)

-V shows the packaging process

-R: append an object to an archive object

-X expands the archive file, which is used in combination with-v and-f.

-T view the file list in the archive file

-C. decompress the package to the specified directory.

Usually used together with a compression Tool

-J: adopts bzip2 Compression

-Z: gzip Compression

-J: adopts xz Compression

Eg. Compression/data

Tar-zcvf/home/redhat/data.tar.gz/data/

/Home/redhat.tar.gz is the compressed file name.

/Data is the directory to be compressed

Decompress/home/redhat/date.tar.gz

 

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.