Compression and packaging instructions for Linux files and file systems

Source: Internet
Author: User

1. The principle of file compression: At present, the computer system is used bytes units to measure, but, in fact, the smallest unit of measurement of computers should be bits, in addition, we also know 1byte=8bits. That is, each byte will have 8 spaces, and each space can be 0 or 1, so if we want to record 1 This number, then we will waste another 7 spaces. Compression technology is the use of some algorithms, these unused controls are thrown out, so that the file occupies less space. Another compression technique is to record the repeated data in a statistical way. For example, 1111 ... 1 A total of 100 1 o'clock, the compression technique is recorded as 100 1 instead of actually storing 100 1.

2. File suffix and compression method:

1) *. Archive for Z:compress program compression

2) *.gz:gzip Program compressed files

3) *.BZ2:BZIP2 Program compressed files

4) The *.tar:tar program is packaged with data that has not been compressed.

5) *.tar.gz:tar program packaged files, and gzip compressed

6) *.tar.bz2:tar Program packaging files, and after bzip2 compression

The usual compression instructions on 3.linux are gzip and bzip2, as far as compress has exited popular. Gzip is an instruction developed by the GNU program that has replaced Compre. Later, GNU developed BZIP2, a compression command that is better than compression. However, these directives are usually only compressed and decompressed for one archive, so that each compression and decompression takes a large stack of files. Therefore, you can use tar for packaging. Tar packs a lot of files into a file, even a directory. Pure tar is just a packaged feature.

4.compress [-RCV] File or directory: Very old instructions, need to install ncompress software. Gzip can unlock this command by compressing the file.

1)-R: can be compressed together with the files in the directory

2)-C: Output compressed data to the screen, can be saved to the specified file via >filename, the source file still exists

3)-V: can show the compressed file information and some compressed file name changes

In the default case, the source file will be replaced by the compressed file.

Uncompress file. Z: Unzip the file, remove the suffix after decompression, and revert to the source file.

5.gzip [-cdtv#] file name; zcat. GZ: Compressed extract archive, Parameters:

1)-C: Display compressed data to the screen, can be processed through data flow guidance

2)-D: Added compression parameters

3)-T: can be used to verify the consistency of a compressed file, to see if the files are error-free

4)-V: can show the original file/compressed file compression ratio and other information

5)-#: Compression level, 1 the fastest, but the worst compression,-9 slowest, but the best compression, preset is-6, enter the number in #

The directive compresses the archive to a file name with a. gz suffix, and the source file no longer exists. In addition, the instructions compressed files can also be windos under the WinRAR software decompression.

Zcat This instruction can read gzip compressed file

6.BZIP2 [-cdkzv#] file name, bzcat file name. BZ2: Provides a better compression scheme than gzip, parameters:

1)-C: Output data generated by the compression process to the screen

2)-D: Uncompressed parameters

3)-K: preserves source files without deleting original archives

4)-Z: Compression parameters

5)-V: can display the original file/compressed file case Compression ratio and other information

6)-#: Same as gzip, all in calculating compression ratio parameters,-9 best,-1 fastest

Bzcat: can also read compressed files

7.tar [-JZ] [CV] [-f file name] FileName: Package and compress

tar [-JZ] [TV] [-F created file name]: View file name

tar [-JZ] [XV] [-F established file name] [-C directory]: Decompression

Parameters:

1)-C: Set up the package file, can be used with the-V to wipe the process of the package file name

2)-T: View the contents of the packaged archive and what file names

3)-X: Unpacking or decompression function, can be solved with-C in a specific directory

Special Note:-c,-t,-x cannot appear in one instruction at the same time

4)-j: Compression/Decompression via BZIP2 support: At this point the file name is finally *.tar.bz2

5)-Z: Compression/decompression via GZIP support: This is the best name for tar.gz

6)-V: Displays the file name being processed during the compression/decompression process

7)-F filename:-f The file name to be processed immediately after

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

9)-P: Retains the original permissions and attributes of the backup data, often used to back up important configuration files

)-P: Retains absolute path, that is, allows the backup data to contain the root directory exists meaning

--exclude=file: During the compression process, do not say FILE packaging.

Instruction Package:

Compression: Tar–jcv–f filename.bar.bz2 The name of the file or directory to be compressed

Enquiry: Tat–jtv–f filename.tar.bz2

Compression: Tar–jxv–f filename.tar.bz2-c directory to extract

The position of the J above can also be changed to-Z for gzip compression mode.

8.dump [-SUVJ] [-level] [-level] [-f Backup Archive] files to be backed up; dump W: Parameters,

1)-S: List only how much space is needed to back up the data to be backed up

2)-U: Record the time of this dump in the Etc/dumpdates file

3)-V: Displays the dump file process

4)-j: Add bzip2 Support, compress the data, the default is BZIP2 compression level of 2

5)-level: Rank, from -0~-8

6)-f filename: The file generated after

7)-W: Lists the partition with dump set in Etc/fstab if there is a backup

9.restore-r [-F DumpFile]: Restore the entire file system, parameters:

1)-T: This mode is used to see what important data is contained in the backup file for dump.

2)-C: This mode allows the data in the dump to be compared with the actual file system

3)-I: Enter the interactive mode, you can restore only some files, used in the dump directory when the restore

4)-R: A mode for restoring the entire file system, used in restoring dump backup for file system

5)-H: View information such as Inode and file system label in full backup data

6)-F: Back to the dump file you're dealing with.

7)-D: With-C, you can find the following mount point and dump has a different file.

10.mkisofs [-O image document][-rv][-m file] files to be backed up ... [-V Vol]–graft-point isodir=systemdir ..., Parameters:

1)-O: Follow the image file name that you want to generate

2)-r: Generate Unix/linux File data through Rock Ridge, can record more information

3)-V: Shows the process of building ISO

4)-M file:-m to exclude the file, the back file does not back up to the image file

5)-V Vol: Build volume, sort of like WinDOS in the file Explorer to see the CD title thing

6)-graft-point:graft has the meaning of passing or transplanting,

11.cdrecord: cd Burning instructions

12.dd-if=inputfile of=outfile bs=blocksize count=number: Parameters,

1) If: is the file to be backed up, or it can be a device

2) of: is the target file of the backup, it can also be a device

3) BS: A block size for the plan, preset 512bytes if not specified

4) Count: How many BS means

13.CPIO–OVCB >[file|device] backup; CPIO-IVCDU <[file|device] restore; CPIO-IVCT <[file|device] View, Parameters:

1)-o: Data copy output to the file or device

2)-B: Let the preset blocks can be increased to 5120bytes, the preset is 512bytes, this can make large file access speed faster

3)-I: Copy data from file or device to system

4)-D: Automatic directory Creation

5)-U: Automatically overwrite older files with newer files

6)-T: Need to match the-I option, can be used to "view" the contents of the file or device created by Cpio

7)-V: Allows the file name to be displayed on the screen during the stored procedure

8)-C: A newer portable format store


This article is from "Tiger Brother's Blog" blog, please be sure to keep this source http://7613577.blog.51cto.com/7603577/1592381

Compression and packaging instructions for Linux files and file systems

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.