Linux disk and file system management 5 ---- compression and packaging of Linux files and file systems

Source: Internet
Author: User
Tags uncompress
The purpose and technology of a compressed file 1 currently our computer uses byte for measurement, but in fact the smallest unit of measurement of the computer is bit. We know that 1 byte = 8bit2 in simple terms, there will be a lot of & ldquo; Space & rdquo; in the file, not completely filled

I. usage and technology of compressed files

1 Currently, our computer uses byte for measurement, but in fact the smallest unit of measurement of the computer is bit. We know that 1 byte = 8bit

2. In short, there will be a lot of "space" in the file, which is not completely filled, and the compression technology is to fill up these "spaces, to reduce the occupied capacity of these files. Since compressed files cannot be directly used by our operating system, to use the file data, we must decompress the files.

3 at present, many www websites use the compression technology for data transmission, so as to increase the availability of website bandwidth.

2. common Linux compression commands

(1) Compress

1 compress is a very old compression technology, because the current gzip can uncompress the compressed file, because it is not explained here

(2) gzip

1. gzip is the most widely used compression command. Currently, gzip can uncompress files compressed by compress, zip, gzip, and other software.

2. the name of the compressed file created in gzip is *. gz.

3 gzip [-cdtv] filename

-C outputs compressed data to the screen and can be processed through data stream redirection.

-D decompression parameters

-T can be used to check the consistency of a compressed file to see if the file has any errors.

-V can be used to display the compression ratio and other information of the original file/compressed file.

4 when we use gzipin to compress, the original file under the initial state will be compressed into a file named .gz. the original file does not exist.

5. files compressed by gzip can be decompressed by WinRAR in windows.

6 cat can be used to view plain text files. zcat can be used to view compressed files after compression.

(3) bzip2

Bzip2 is designed to replace gzip and provide a better compression ratio. bzip2 has a better compression ratio than gzip.

2 bzip2 [-cdkzv] filename

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

-D decompression parameters

-K retains the original file and does not delete the original file.

-Z compression parameters

-V displays the compression ratio of the original file/compressed file.

3. use the compress extension *. Z, and use the extension *. gz of gzip. The bzip2 extension here is *. bz2.

4. we can use bzcat to read bzip2 compressed files.

(4) tar

1 tar can package multiple directories or files into a large file, and supports gzip/bzip2 compression.

2. compress tar-jcv-f filename.tar.bz2

Query tar-jtv-f filename.tar.bz2

Decompress tar-jxv-f filename.tar.bz2-C

3 If the-j parameter is added, it indicates bzip2 compression. Therefore, it is best to name the file * .tar.bz2

If the-z parameter is added to indicate gzip support, the file name should be * .tar.gz.

4. when learning tar, separating-f filename from other parameters will be less likely to cause problems.

Three backup tools and burning tools

1 dump is very powerful, in addition to backing up the entire file system, you can also set a level

2. handling of command line burning:

1) first, build the required backup data into an image file iso, and use the mkisofs command for processing.

2) burn the image file to a CD/DVD and use cdrecord to process it.

3 dd commands can be used not only to create a large file, but also to back up data using dd commands.

4 dd if = "input file" of = "output file"

If it is input file or device, of IS output file or output device.

Dd if =/etc/passwd of =/tmp/passwd. back is used to back up/etc/passwd to/tmp/passwd. back

If we want to restore the data back, we just need to reverse it.

5 tar can be used to back up key data, while dd can be used to back up the entire partition or the entire disk

6 dd can copy the data of the original slice in the original partition, together with the superblock, boot sector, meta data, and so on.

For example, dd if =/dev/sda of =/dev/sdb can make the two disks the same, and/dev/sdb does not need to be formatted at all, this command can copy all data in/dev/sda, including MBR and partition tables, to/dev/sdb.

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.