File and file system compression and packaging

Source: Internet
Author: User

File and file system compression and packaging Basic compression command

1. Gzip is the most widely used compression command. Bzip2 is designed to replace gzip and provide a better compression ratio.

During compression, Bzip2 is more powerful and can save the original file, while gzip cannot.

Gzip [-cdtv #] File Name

Bzip2 [-cdkzv #] File Name

2. For compressed text, we can also view the content of the compressed file through zcat and bzcat.

3. Packaging command: Tar

The simplest way to use tar is as follows:

Compression: name of the file or directory to be compressed by tar-JVC-F filename.tar.bz2

Query: tar-jtv-F filename.tar.bz2

Decompress: tar-jxv-F filename.tar.bz2-C directory to be decompressed (-C can use this parameter to decompress files in a specific directory)

 

 

How to decompress a single file: eg: tar-jtv-F/root/etc.tar/bz2 | gerp 'shadow'

Grep is used to select keywords.

 

4. Full backup tool: Dump

Dump has powerful functions. In addition to backing up the entire file system, you can also set a level.

When you back up a file system, level0 is used for the first backup. This level is full backup. During the second backup, the data in the real-time file system is different from level0, level1 only backs up changed files after comparing the differences between the current file system and level0. This is classified backup.

If the dump Backup Directory is used, the backup data must be under this directory and only level0 can be used. That is, only full backup is supported, and the U parameter is not supported.

/Etc/dumpdates the level backup time record file.

5. Restore backup data: Restore

Backup files are important data that can be recovered in an emergency, so we should know how to recover them. Dump resumes using the restore command.

6. CD Writing Tool

First, create an image file: mkisofs

CD burning tool: cdrecord

Reference Book p265 for details

7. Other common compression and backup tools

DD, a very powerful backup tool, such as: dd If =/etc/passwd of =/tmp/passwd. Back

Eg: dd If =/dev/HDC of =/tmp/MBR. Back BS = 512 COUNT = 1; back up MBR and partition tables in the first sector

Cpio can back up everything, including device files. However, cpio has a problem. It does not take the initiative to find files for backup. Reference books p270

 

Important Review

 

 

 

 

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.