Linux Learning Three: Archive and file system compression and packaging

Source: Internet
Author: User
Tags bz2 disk usage

Archives are compressed to make files more convenient to transport over the network and to reduce the amount of hard disk usage. The principle of compression is that the file is stored with a lot of space is useless, and compression is to release these spaces.

Several common compression suffix names for Linux:

*. Z Compress program compression files;

*.gz gzip program compress files;

*.BZ2 bzip2 program compression files;

*.tar Tar program packaging data, and has not been compressed;

*.tar.gz Tar program package files, which are also compressed by gzip

*.TAR.BZ2 Tar program package file, which and after bzip2 compression

The usual compression commands are gzip and bzip2. Compress now only on some older machines can see this command, and after the compress compressed files can be extracted via gzip.

1) Gzip Zcat

Gzip can be said to be the most widely used compression instruction now! Currently gzip can unlock files that are compressed by software such as Compress,zip and gzip. The compressed file created by gzip is the *.gz filename.

Command format: gzip [-cdtv#] File name

Options and Parameters:

-C: Output compressed data to the screen, can be redirected through the data stream 杢 processing;

-D: extracting parameters;

-T: can be used 杢 test a compressed file consistency ~ See if the file has the wrong jest;

-V: Can show the original file/compressed file compression ratio and other information;

-#: Compression level, 1 the most corporate, but the worst compression, 9 slowest, but the best compression! Pre-ou yes-6

After compressing the files, we can try to read them in Zcat.

2) bzip2 Bzcat

BZIP2 is designed to replace Gzip and provide a more compression ratio.

Command format: bzip2 [-cdkzv#] File name

Options and Parameters:

-C: Output The compressed process data to the screen!

-D: Extracting parameters

-K: Keep the source file, not delete the original files Oh!

-Z: Compression parameter-V: can show the original file/compressed file compression ratio and other information;

-#: Same as gzip, all in the calculation of compression ratio parameters, 9 best, 1 most corporate!

3) Packing Command tar

Command format: tar [-j|-z] [CV] [-F Build file name] filename ... <== package does not compress

tar [-j|-z] [TV] [-F Build file name] <== view file name

tar [-j|-z] [XV] [-F Build file name] [-C directory] <== extract

Common parameters:

-C: Set up a package file to match

-V 杢 the file name (filename) that was packaged during the view

-T: Look at the contents of the package file of what file name, focus on the "file name" is;

-X: Unpack the withdrawal function, can be combined with-C (uppercase) in a specific directory to unlock special attention is,-C,-T, X can not appear in a series of LED.

-J: Support Import line compression/decompression through BZIP2: This is the best name for *.tar.bz2

-Z: Supports import compression/decompression via gzip: The file name is preferably *.tar.gz.

-V: During the compression/decompression process, the file name being processed is displayed 杢!

The file name to be processed immediately after the-F filename:-f! Recommended-F Write a separate election!

-C Directory: This option is used in decompression, to extract in a specific directory, you can use this option.

-P: Retain the original permissions of the backup data properties, commonly used to backup (-C) Important configuration files

-P: Reserved absolute path, that is, to allow the backup data tons have root directory exists remainders meaning;--exclude=file: In the process of compression, do not package FILE!

In fact, the simplest way to use tar is to memorize the following:
? Compression: tar-jcv-f filename.tar.bz2 file ring directory name to be compressed
? Enquiry: Tar-jtv-f filename.tar.bz2
? Decompression: Tar-jxv-f filename.tar.bz2-c to extract the directory

3) Full Backup tool dump

You can use the dump command when you want to backup or store the file system at some point. In addition to being able to back up the entire file system, this instruction can also back up the directory.

Dump can also specify the level of backup

Command format: Dump [-SUVJ] [-level] [-f backup file] data to be backed up

Select is not a parameter:

-S: Lists only how much disk space is needed to back up the data to be backed up;

-U: Log the time of the dump to the/etc/dumpdates file;

-V: The dump file process shows the 杢;

-J: Join BZIP2 support! Compress data import row, default bzip2 compression level is 2

-level: That's the level we're talking about, from 0 to 9 total 10 levels;

-F: A bit like tar! Follow the resulting file, or the/DEV/ST0 device file name, etc.

-W: List the partition with Dump OU in/etc/fstab is there a backup?

command to restore Backup files: Restore

Write to disc: the data that needs to be backed up is now built into an impact file (ISO), processed using the MKISOFS directive, and then burned on a disc or DVD, using the Cdrecord directive.

Linux Learning Three: Archive and file system compression and packaging

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.