Linux Compressed File __linux

Source: Internet
Author: User
Tags bz2 gz file rar


*. Z Compress program compressed file;
*.BZ2 bzip2 program compressed files;
*.GZ gzip program compressed file;
The data packaged by the *.tar tar program has not been compressed;
*.tar.gz The TAR program's packaged files, which are compressed by gzip.
*.zip Zip Program compressed file
*.rar RAR Program Compressed file

Compress compressed Files

Compress is a rather old UNIX archive compression directive, and the compressed file will be added to one. Z extension file name to distinguish uncompressed files, compressed files can be uncompress decompression. To compress several files into one compressed file, you must first tar the files and then compress them. Since gzip can produce a more desirable compression ratio, most people have switched to gzip as the archive compression tool.
How to use: Compress [-DFVCV] [-B maxbits] [file ...]
Parameters:
C output to standard output device (usually on screen)
F forced to write file, if the destination file already exists, it will be overwritten (force)
V to print the message of program execution on the screen (verbose)
b sets the upper limit of the number of common strings, which, in bits, can be set to a value of 9 to bits. Because the larger the value, the greater the number of common strings that can be used, and the greater the compression ratio, so you typically use the preset bits (bits)
D Unzip the compressed file
V List Version messages
 
The Source.dat is compressed into source.dat.z, and if source.dat.z already exists, the content is overwritten by the compressed file.
Compress-f Source.dat
Compress the Source.dat into Source.dat.z, and print out the compression ratio.
-V and-F can be used together
COMPRESS-VF Source.dat
After the compressed data is exported and then imported TARGET.DAT.Z can change the compressed file name.
Compress-c Source.dat > Target.dat.z
The larger the value of-B, the greater the compression ratio, the range is 9-16, the default value is 16.
Compress-b Source.dat


gzip Compressed files and Zcat
Syntax: gzip [option] Compressed (uncompressed) file name
The options for this command have the following meanings:
-C writes the output to the standard output and retains the original file.
-D Unzip the compressed file.
-L Displays the following fields for each compressed file:
size of compressed file; size of uncompressed file; compression ratio; name of uncompressed file
-R recursively finds the specified directory and compresses all files in it or is uncompressed.
-T test to check that the compressed file is complete.
-V displays filename and compression ratio for each compressed and decompressed file.
-num adjusts the speed of compression with the specified number num,-1 or--fast represents the fastest compression method (low compression ratio),
-9 or--best represents the slowest compression method (high compression ratio). The default value for the system is 6.

Gzip *
% to compress each file in the current directory into. gz files.
GZIP-DV *
% unzip each compressed file in the current directory and list detailed information.
Gzip-l *
% displays information about each compressed file in Example 1 and does not understand the pressure.
Gzip Usr.tar
% Compressed tar backup file Usr.tar, at which time the compressed file extension is. tar.gz.

BZIP2 Compressed Files and Bzcat
bzip2 [-cdfhklstvvz][--repetitive-best][--repetitive-fast][-compression level] [files to compress]
-C or--stdout sends the results of compression and decompression to standard output.
-D or--decompress to perform the decompression.
-F or--force bzip2 when compressing or decompressing, presets do not overwrite existing files if the output file has the same name as an existing file. To overwrite, use this parameter.
-h or--help display Help.
A-K or--keep bzip2 deletes the original file after compression or decompression. Use this parameter if you want to keep the original file.
-S or--small reduces the amount of memory used when the program executes.
-T or--test test. bz2 the integrity of the compressed file.
Displays detailed information when you compress or unzip a file-V or--verbose.
-Z or--compress to enforce compression.
-L,--License,
-V or--version display version information.
--repetitive-best If there are duplicate data in the file, this parameter can be used to improve the compression effect.
--repetitive-fast This parameter can be used to speed up execution if there are duplicate data in the file.
-Block size at compression level compression.

Bzip2–z Test1.txt

Tar compressed file

tar [-ZXCVFPP] filename
Tar-n ' yyyy/mm/dd '/path-zcvf target.tar.gz source
Parameter description:
-Z: Whether to have gzip properties at the same time.
-X: Unlocks a parameter instruction for a compressed file.
-T: View the files inside the tarfile.
-C: Create a parameter command for a compressed file
-V: Displays the file during compression.
-F: Use file name, please note that after F to immediately pick up the file name Oh. Don't add any more parameters.
For example, the use of "TAR-ZCVFP tfile sfile" is the wrong way to write
"TAR-ZCVPF tfile sfile" is right.
-P: Use the original property of the original file (properties are not changed according to the user)
-P: You can use absolute paths
-N: Newer than the following date (YYYY/MM/DD) will be packaged into the newly created file.
--exclude file: Do not package file in the process of compression.

TAR-CVF Directory.tar Directory
Package catalog consolidation into one file only
TAR-ZCVF directory.tar.gz Directory
In addition to packaging the directory, at the same time with gzip compression
TAR-ZCVF filename.tar.gz/home/test/*
Pack and compress the files/home/test/this directory into a filename.tar.gz file.
Tar-jcvf/tmp/etc.tar.bz2/etc <== packaged to bzip2 compression
TAR-XVF Directory.tar
To unpack the tar, note that you do not have the effect of gzip (. Tar instead of. tar.gz), so just use –XVF. You do not need to add Z, otherwise it will show a problem.
TAR-ZXVF directory.tar.gz
This is the result of a compression with gzip plus. So you need to add –z yo.
TAR–ZTVF directory.tar.gz
This t can be used to view the file information in tar. Without having to untie him.
TAR-ZCVPF Home.tar.gz/home
The file in the compressed file is an absolute path.
Please note that when using this p parameter, do not add p to the back of F, because
Immediately after the F to receive the file name to do OH.
Tar-n ' 2002/06/25 '-ZCVF home.tar.gz/home
It says that in the/home directory, new files are packaged into the home.tar.gz file than the 2002/06/25 day.
TAR-ZCVF host.tar.gz/--exclude/mnt--exclude/proc
It says that all of the data in the root directory is packaged into the host.tar.gz file, but/mnt and/proc are not packaged.
TAR-CVF-/home | TAR-XVF-
The above means "after packing/home, directly unzip under/root." Hey There is no need to establish an intermediate file again. However, using the above syntax is best used "absolute path", the comparison is not a problem. This is a good way to avoid creating intermediate files.
Zip and Unzip compressed files
Zip-r myfile.zip.///Compress all files and folders in the current directory into Myfile.zip files,-R for all files under the recursive compression subdirectory.
zip-d myfile.zip smart.txt//delete smart.txt files in compressed files
Zip-m myfile.zip./rpm_info.txt//Add Rpm_info.txt file to Myfile.zip in compressed file
Unzip-o-d/home/sunny myfile.zip//extract myfile.zip files to/home/sunny/

RAR Compressed Files

RAR is usually better than zip compression, but the compression/decompression speed is slower.



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.