Linux compression and Backup commands Daquan _linux shell

Source: Internet
Author: User
Tags bz2

First, compression and decompression

1, compress [-RCV] file or directory <== compression

uncompress files. Z <== Decompression

-R: Can be compressed together with the files in the directory

-C: Export compressed data to standard output (output to screen)

-V: Can display the compressed file information and some file name changes during the compression process

(This order is a very old one.)

2, gzip [-cdtv#] filename

-C: Output compressed data to the screen, which can be processed by data flow redirection

-D: Uncompressed parameters

-T: can be used to verify the consistency of a compressed file to see if the file has errors

-V: Can display information such as compression ratios

-#: Compression level,-1 the fastest, but compression ratio is the worst,-9 slowest, but compression ratio is best, preferably the default-6

Note: The original file will be overwritten by default, and the combination of-C and > can be used to keep the source file (for example, Gzip-c man.config > man.config.gz The source file will be retained at this time)

Zcat file name. GZ read. GZ compressed package (previous hint original file as text file)

3, bzip2 [-cdkzv#] filename

-C: Output data from the compression process to the screen

-D: Uncompressed parameters

-K: Keep source files

-Z: Compressed parameters

-V: Displaying information such as compression ratios

-#: With gzip

Bzcat file name. bz2 read. BZ2 Compressed Package

Decompression allows you to use BUNZIP2 instead of bzip2-d

4, Packaging command tar (you can package multiple directories or files into a large file, but also through the support of GZIP/BZIP2, the file can be compressed)

tar [-j|-z] [CV] [f new filename] filename ... <== packaging and compression

tar [-j|-z] [TV] [-f new FileName] <== view file name

tar [-j|-z] [XV] [f new filename] [-C directory] <== decompression

-C: New package file, with-V to see the packaged file name in the process

-T: See what file names are in the contents of the packaged file, focus on viewing the file name

-X: Uncompressed or unpacked functionality that can be untied with-C in a particular directory (-c,-t,-x cannot appear on the same command line at the same time)

-J: Compression/decompression via BZIP2 support, at which time the filename is best *.tar.bz2

-Z: Compression/decompression via gzip support, at which time the filename is best *.tar.gz

-V: Displays the file name that is being processed during the compression/decompression process

-F filename:-f followed by the file name being processed

-C Directory: This parameter is used when decompressing, to extract in a specific directory

-P: Preserve the original attributes and permissions of the backed-up data

-P: Preserves absolute path, that is, allows the backup data to contain the root directory

--exclude=file: Do not package file in the process of compression

--newer-mtime= ' Date ': Update only newer files than date at this time

Second, backup command

1, dump backup of the entire file system and a single directory (limited to backup support for a single directory is less)

dump [-SUVJ] [-level] [-f backup file] data to be backed up

-S: Only the amount of disk space needed to back up the data to be backed up

-U: Record the dump time in the/etc/dumpdates file

-V: Displays the dump file procedure

-J: Join BZIP2 Support, compress the data, the default compression level is 2

-level: Compression level, op. cit.

-F: Files that are generated later

-W:L lists whether the partition with the dump setting in the/etc/fstab has been prepared

If the data to be backed up is just a directory, not a single file system, there are limits:

(1) All backup data must be under this directory

(2) and can only use Leve 0, that is, support full backup

(3) the-u parameter is not supported, that is, the time record file/etc/dumpdates This level backup cannot be created

2, dump recovery using the RESTORE command

Restore-t [-F DumpFile] [-h] <== used to view dump files

Restore-c [-F dumpfile] [-D mount Point] <== compare dump with actual file

Restore-i [f DumpFile] <== into interactive mode

Restore-r [-F DumpFile] <== restore the entire file system

-T: This mode is used to see what important data is in the dump backup file

-C: This mode can be compared with the actual file system by taking out the data in the dump

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

-R: A mode of restoring the entire file system, used to restore the backup to the file system

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

-F: Take the dump file that you want to work with later

-D: With-C, you can find the following mount point and dump in a different file

3, have the CD-ROM writing tool

Step one: Create a new mirrored file mkisofs [-o mirrored file] [-RV] [-m file] to back up files ... [-V vol.]-graft-point isodir=systemdir ...

-O: followed by the image file name you want to produce

-r: Generate supporting Unix/linux file data through Rock Ridge

-V: Shows the process of building ISO files

-M file:-m for exclude files

-V Vol.: New Volume

-graft-point:graft have the meaning of passing or transplanting

Step two: Burn the mirrored file to a CD or DVD

Cdrecord-scanbus dev=ata <== Query Burner location

Cdrecord-v dev=ata:x,y,z Blank=[fast|all] <== Erase Duplicate read-write slices

Cdrecord-v dev=ata:x,y,z-format <== Format DVD+RW

Cdrecord-v dev=ata:x,y,z [available parameters feature] File.iso

-scanbus: Used on the scan disk bus and find the available burner, followed by the ATA interface device

-V: The process of running in Cdrecord, showing the process only

Dev=ata:x,y,z: The subsequent x,y,z is important for the location of the burner on your system.

Blank=[fast|all]:blank to erase repeatable write CD/DVD-RW, use fast faster, all more complete

-format: DVD In this format only for DVD+RW

The available parameters feature is primarily a parameter to use when writing a CD/DVD:

-data: Specifies that the following file is written in data format, not as a CD track

Speed=x: Specify Burn Speed

-eject: Specifies that the disc is automatically exited after burning

Fs=ym: Specify how much buffer memory, can be used in the image file staging area, the default is 4M, generally recommended to increase to 8M

Parameter Features for DVD:

Driveropts=burnfree: Open the Write function of the buffer underrun free mode

-sao: Support for DVD-RW format

4, DD can back up the full partition or disk, because the DD can read the disk's sector surface data

DD if= "input file" of= "Output File" bs= "Block Size" count= "number"

If: is input file

Of: Is output file

BS: The size of a planned block, which defaults to 512bytes if specified

Count: How many BS mean

5, Cpio can remark anything, cpio have to cooperate with similar find and so can locate the file name of the command to tell Cpiof the backup of the data where

CPIO-OVCB > [File|device] <== Backup

CPIO-IVCDU < [File|device] <== Restore

CPIO-IVCT <[file|device] <== view

The backup will use the parameters:

-O: Output data Copy to a file or device

-B: Allow the default bloks to be increased to 5120bytes, the default is 512beytes

The parameters that the restore will use:

-I: Copying data from a file or device into a system

-D: Automatically create a new directory

-U: Automatically overwrite older files with newer files

-T: Need to match the-I parameter, can be used to view the contents of a newly created file or device in Cpio

Some of the shared parameters:

-V: Allow file names to be displayed on the screen in stored procedures

-C: A newer type of portable format storage

The above is a small set to introduce the Linux compression and backup command Daquan, I hope to help you, if you have any questions please give me a message, small series will promptly reply to everyone. Here also thank you very much for the cloud Habitat Community website support!

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.