05 _ packaging and compression, 05 _ packaging and Compression

Source: Internet
Author: User
Tags uncompress

05 _ packaging and compression, 05 _ packaging and Compression

Note:

This blog is mainly about linux's most basic compression, decompression, and packaging operations)

1. Common compression commands 1. compress (*. Z)

The old compression software can be replaced by gzip

Compress [-rcv] file or directory

Uncompress file. Z

-R: the files in the directory are compressed together.

-C: Output compressed data to the screen

-V: displays the compressed file information and file name changes during compression.

Compress filename> filename. back. ZCompress and save the original file

 

2. gzip (. * gz), zcat

Uncompress, zip, and gzip files

Gzip [-cdtv #] filename

-C: output the compressed data to the screen and process it through data stream redirection.

-D: Extract

-T: Check the consistency of compressed files.

-V: Display File compression ratio

-#: Compression level.-1 is the fastest, but the compression ratio is the worst.-9 is the slowest, but the compression ratio is the best. The default value is 6.

Zcat filename.gz

Read compressed file content

Gzip-v 01_base.txt display compression ratio

Zcat 01_base.txt.gz displays the File Content

Gzip-d 01_base.txt.gz Extract

Gzip-9-c 01_base.txt> 01_base.txt.gz keep the original file

 

3.bzip2, bzcat

Bzip2 [-cdkzv #] filename

Bzcat filename.bz2

-C: output the data generated during the compression process to the screen.

-D: extract parameters.

-K: Retain the original file

-Z: Compression Parameters

-V: displays compression ratio (original/post) and other information.

-#: Same as gzip

Bzip2-z 01_base.txt

Bzip2-d 01_base.txt.bzip2

Zcat 01_base.txt.bzip2

 

Ii. Packaging: tar1.tar

Tar [-j |-z] [cv] [-f newfile] filename packaging and Compression

Tar [-j |-z] [TV] [-f newfile] View File Name

Tar [-j |-z] [xv] [-f newfile] [-C Directory] decompress

-C: Create a new package file and use v to view the package file name.

-T: view the file names in the package.

-X: Extract

-J: Use bzip2 for compression and decompression

-Z: Using gzip

-P: retains the original permissions and attributes of backup data. It is often used to back up important configuration files.

-P: retain the absolute path, that is, the root directory, which is removed by default.

-- Exclude = FILE: Do not package the FILE during packaging.

 

Compression: files or directories to be compressed by tar-jcv-f filename.tar.bz2

Query: tar-jtv-f filename.tar.bz2 | grep "file"

Decompress: tar-jxv-f filename.tar.bz2-C to decompress the Directory

Tar-jxv-f filename.tar.bz2 open file name to unbind a single file

Tar-jcv-f docum.tar.bzip2 docum Compression

View tar-jtv-f extension .tar.bzip2

Tar-jxv-f pai.tar.bzip2-C ../decompress the package to the upper-layer folder.

Tar-jxv-f 2.16.tar.bzip2 docum/01_base.txt extract the 01_base.txt File

Tar-jcv-f unzip .tar.bzip2 -- exclude = docum/01_base.txt docum/unzip folder in addition to 01_base.txt package Compression

2.tar File

Tarfile: Only packageTar-cv-f file.tar

Tarball: compress tar-jcv-f file.tar.bzip2

Tar-cv-f/dev/st0/home/root/etc package the/home/root/etc folder to the tape drive

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.