Summary of compression and backup commands in Linux
One, compression and decompression
1. Compress [-RCV] file or directory <== compression
Uncompress file. Z <== Decompression
-R: can also be compressed together with the files in the directory
-C: Export compressed data to standard output (outputs to screen)
-V: Can display the compressed file information and some file name changes during the compression process
(This command is a very old one.)
2. gzip [-cdtv#] File name
-C: Output compressed data to the screen, which can be processed by data flow redirection
-D: decompressed 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 ratio
-#: Compression level, 1 the fastest, but the worst compression,-9 slowest, but the best compression, preferably the default-6
Note: By default, the original file will be overwritten, to keep the source file can use a combination of-C and > (for example, Gzip-c man.config > man.config.gz The source file will be retained)
Zcat file name. GZ reads. GZ compressed packets (before prompting the original file as a text file)
3. bzip2 [-cdkzv#] File name
-C: Output data generated during compression to the screen
-D: decompressed parameters
-K: Keep source files
-Z: Compressed parameters
-V: Display information such as compression ratio
-#: With gzip
Bzcat file name. bz2 read. BZ2 Compressed Package
Decompression can 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 file name] <== view file name
tar [-j|-z] [XV] [-f new FileName] [-C directory] <== extract
-C: New package file, can be paired with-V to see the file name being packaged in the process
-T: See what file names are in the contents of the packaged files, focusing on viewing file names
-X: Decompression or unpacking function, can be solved with-C in a specific directory (-c,-t,-x cannot appear on the same command line at the same time)
-J: Compression/Decompression with BZIP2 support, at which point the file name is preferably *.tar.bz2
-Z: Compression/decompression with GZIP support, at which point the file name is preferably *.tar.gz
-V: Displays the file name being processed during the compression/decompression process
-F filename:-f followed by the processed file name
-C Directory: This parameter is used to decompress in a specific directory at the time of decompression
-P: Preserve the original properties 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 a new file than the time of date
Second, backup command
1. Dump backs up the entire file system and single directory (limited to insufficient backup support for a single directory)
dump [-SUVJ] [-level] [-f backup file] data to be backed up
-S: Lists only how much disk space is needed to back up the data to be backed up
-U: Log the time of this dump to the/etc/dumpdates file
-V: Displays the file process of the dump
-J: Add bzip2 Support, compress the data, the default compression level is 2
-level: Compression level, Previous
-F: The resulting file after
-W:L lists whether the partition with the dump setting in/etc/fstab has been prepared
If the data to be backed up is simply, the directory, not a single file system, has limitations:
(1) All backup data must be under this directory
(2) and can only use Leve 0, that is, full backup is supported
(3) the-u parameter is not supported, that is, the time log file for the/etc/dumpdates level backup cannot be created
2. Recovery of dump using the RESTORE command
Restore-t [-F DumpFile] [-h] <== to view the dump file
Restore-c [-F dumpfile] [-D mount Point] <== compare dump with actual file
Restore-i [-F DumpFile] <== Enter interactive mode
Restore-r [-F DumpFile] <== restore entire file system
-T: This mode is used to view what important data is contained in the backup file for dump.
-C: This mode can take the data in the dump to compare with the actual file system
-I: Enter the 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 a backup of the file system
-H: View information such as Inode and file system label in full backup data
-F: Back to the dump file you're going to handle.
-D: With-C, you can find the next mount point and dump have different files
3. There is a CD-ROM writing tool
Step one: Create a new image file Mkisofs [-o image file] [-RV] [-m file] files to be backed up. [-V vol]-graft-point isodir=systemdir ...
-O: Follow the image file name that you want to generate
-r: Generate supported Unix/linux file data via Rock Ridge
-V: Shows the process of building the ISO file
-M file:-m to exclude files
-V Vol: New volume
-graft-point:graft has the meaning of passing or transplanting.
Step Two: Burn the image file to a disc or DVD
Cdrecord-scanbus Dev=ata <== Location of the query burner
Cdrecord-v dev=ata:x,y,z Blank=[fast|all] <== Erase Duplicate read-write tablets
Cdrecord-v Dev=ata:x,y,z-format <== Formatting dvd+rw
Cdrecord-v dev=ata:x,y,z [available parameters function] File.iso
-scanbus: Used to scan the disk bus and find the available recorders, subsequent devices are ATA interfaces
-V: The process of running in Cdrecord, showing the process only
Dev=ata:x,y,z: The subsequent x, Y, Z is the location of the recorder on your system, which is very important
Blank=[fast|all]:blank to erase repeatable write CD/DVD-RW, use fast faster, all is more complete
-format: DVD only for DVD+RW this format
[Available parameter function] is mainly the parameters that can be used when writing CD/DVD:
-data: Specifies that subsequent files are written in data format, not as CD tracks
Speed=x: Specify the burning speed
-eject: Specifies that the disc is automatically exited when burning is complete
Fs=ym: Specify how much buffer memory, can be used in the image file staging area, default to 4M, general recommendations can be increased to 8M
Parameter Features for DVD:
Driveropts=burnfree: Open the Write function of buffer underrun free mode
-sao: Support for DVD-RW format
4, DD can back up the complete partition or disk, because DD can read the disk sector surface data
DD if= "input file" of= "Output File" bs= "Block Size" count= "number"
If: is the input file
Of: is the output file
BS: The size of a block planned, the default is 512bytes if specified
Count: How many BS means
5, Cpio can note anything, cpio to cooperate with similar to find the name of the command can be found to tell Cpiof where the data of the backup
CPIO-OVCB > [File|device] <== Backup
CPIO-IVCDU < [File|device] <== Restore
CPIO-IVCT <[file|device] <== view
The backup will use the parameters:
-o: Data copy output to a file or device
-B: The default bloks can be increased to 5120bytes, the default is 512beytes
The parameters that the restore will use:
-I: Copy data from file or device to system
-D: Automatically create a new directory
-U: Automatically overwrite newer files with older files
-T: Need to mate-I parameter, can be used to view the contents of a new file or device to Cpio
Some of the shared parameters:
-V: Let the stored procedure file name can be displayed on the screen
-C: A newer portable format store
Linux compression decompression and backup commands