Linux file archiving and compression (Learn note eight)

Source: Internet
Author: User

I. Archiving and compression
    • Compression Command tool: GZIP,BZIP2
    • Archive Command tool: Tar
Second, compression

2.1. Gzip

Gzip is a standard, widely-used file compression and decompression utility. Gzip allows file to be collocated. With gzip compressed files, you can get tarball packaged files in the format "*.tar.gz" or "*.tgz".

Gzip Options

    • –stdout: Writes the output to the standard output device.
    • –to-stdout: Writes the output to the standard output device.
    • –decompress: Unzip the file.
    • –uncompress: Unzip the file.
    • -D: Unzip the file.
    • -F: Forced compression/decompression.
2.2, BZIP2

BZIP2 will get a higher compression rate than gzip

Command: bzip2 [options] [filename] parameter-C sends the result of the compression/decompression to standard output-D to extract the specified target file. -Z enforces compression, whether compression command bzip2 or decompression command bunzip.-k the original file during compression or decompression. -F forced override. -T checks the integrity of the specified compressed file, but does not decompress it. -S reduces memory utilization. -V Displays the compression ratio of the compressed file. --processing of files beginning with "-" such as: bzip2---filename--help display Help-num to adjust the compression speed with the specified number-1 or--fast for the fastest compression (low compression ratio), 9 or-best, which indicates the slowest (high compression ratio), the system defaults to 6. Third, archiving

An archive file is a compressed file that consists of one or more computer files and metadata

3.1 Features of the archive
    • Data compression
    • Encryption
    • File collocated
    • Automatic decompression
    • Automatic installation
    • Source volume and media information
    • File spanning
    • Checksum
    • Directory structure Information
    • Other metadata (data about the data)
    • Error discovery
3.2. Tar command:

Tar is the standard Unix/linux Archiving application tool. In the early stages, it used to be a tape archive software that later evolved into a generic archive package capable of processing various types of archive files. Tar can accept many archive filters with options.

tar option -A: Adds a tar file to the end of an existing archive. -C: Create a new archive file. -D: Compare archives using the specified file system. -J: Archive with bZIP compression. -R: Adds the file to the end of the existing archive. -T: Lists the contents of an existing archive. -u: Update archive. -x: Unzip the file from the existing archive. -Z: Archive with gzip compression. –delete: Delete files from an existing archive. 

Graphical View:

Create an archive file:

tar -zcvf test4. tar. GZ test4/    // Test4 folder as an archive file test4/test4/hh.txttest4/  Yy.txttest4/a.txttest4/lsa.txt  com    file1.txt  httpd.conf  test1  test4. Tar . Gzb.txt  c.txt  file2.doc  test        test4  tests[[email protected] documents]#

Unzip the archive file:

[[Email protected]Tar]#Tar-ZXVF test4.Tar. GZ test4/test4/Hh.txtTar: Test4/hh.txt: TimeStamp -- Geneva- -  .: the: onIs17199.007385938SinchThe futuretest4/Yy.txttest4/a.txtTar: Test4/a.txt: TimeStamp -- Geneva- -  .: the: onIs17199.006267373SinchThe futuretest4/TestTar: test4/test: TimeStamp -- Geneva- -  .: the: onIs17199.005671909SinchThe future[[email protected]Tar]#lstest4 test4.Tar. Gz[[email protected]Tar]#

Linux file archiving and compression (Learn note eight)

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.