This article describes the programs that are compressed under Linux, such as tar, gzip, gunzip, bzip2, bunzip2, compress, uncompress, zip, unzip, RAR, Unrar, and how to use them for. Tar,. GZ,. tar.gz,. tgz,. bz2,. tar.bz2,. Z. Tar. Z,. zip,. rar 10 kinds of compressed files to operate
This article describes the programs that are compressed under Linux, such as tar, gzip, gunzip, bzip2, bunzip2, compress, uncompress, zip, unzip, RAR, Unrar, and how to use them for. Tar,. GZ,. tar.gz,. tgz,. bz2,. tar.bz2,. Z. Tar. Z,. zip,. rar 10 kinds of compressed files to operate
The most common packaging program under Linux is tar, which is often referred to as the TAR package, and the tar package file commands are usually terminated with. Tar. After the tar package is generated, it can be compressed with other programs, so the basic usage of the tar command is first spoken:
There are many options for the tar command (which can be viewed with man tar), but there are a few options that are commonly used, as illustrated below:
?
1 |
# tar -cf all.tar *.jpg |
This command is to make all. jpg files into a package named All.tar. -C is the file name that represents the generation of a new package,-f specifies the package.
?
1 |
# tar -rf all.tar *.gif |
This command adds all the. gif files to the All.tar package. -R is meant to increase the file.
?
1 |
# tar -uf all.tar logo.gif |
This command is to update the original tar package All.tar in the logo.gif file,-U is to indicate the meaning of the update file.
?
This command is to list all the files in the All.tar package,-T is to list the meaning of the file
?
This command is to solve all the files in the All.tar package,-X is the meaning
These are the most basic uses of tar. Tar provides a special feature to facilitate the user's ability to compress or decompress a file while unpacking the package. This is what tar can call other compression programs while packaging or unpacking, such as calling Gzip, bzip2, and so on.
1) Tar call
Gzip is a compression program developed by the GNU organization, and the. Gz end file is the result of gzip compression. The decompression procedure relative to Gzip is gunzip. Use the-Z parameter in tar to invoke gzip. Here's an example:
?
1 |
# tar -czf all.tar.gz *.jpg |
This command is to make all. jpg files into a tar package and compress them in gzip to generate a gzip compressed package named all.tar.gz
?
This command unlocks the package generated above.
2) Tar call bzip2
Bzip2 is a more compressible compression program, and the. bz2 end of the file is the result of bzip2 compression.
The decompression procedure relative to bzip2 is bunzip2. Use the-j parameter in tar to invoke gzip. Here's an example:
?
1 |
# tar -cjf all.tar.bz2 *.jpg |
This command is to make all. jpg files into a tar package and compress them with bzip2 to generate a bzip2 compressed package named all.tar.bz2
?
This command unlocks the package generated above.
3) Tar call compress
Compress is also a compression program, but it seems that people who use compress are not as good as gzip and bzip2. The file at the end of Z is the result of bzip2 compression. The decompression procedure relative to compress is uncompress. Use the-Z parameter in tar to invoke compress. Here's an example:
?
1 |
# tar -cZf all.tar.Z *.jpg |
This command is to make all. jpg files into a tar package and compress them with compress to generate a uncompress compressed package named All.tar.z
?
This command unlocks the package that was created above.
with the above knowledge, you should be able to solve a variety of compressed files, the following for the TAR series of compressed files to make a summary :
1) for files ending in. tar
TAR-XF All.tar
2) for files ending in. gz
Gzip-d all.gz
Gunzip all.gz
3) for files ending with. tgz or. tar.gz
Tar-xzf all.tar.gz
Tar-xzf all.tgz
4) files ending with. bz2
Bzip2-d all.bz2
BUNZIP2 all.bz2
5) For tar.bz2 end of file
TAR-XJF all.tar.bz2
6) for. Z End of File
Uncompress all. Z
7) files ending with. tar.z
Tar-xzf All.tar.z
In addition, there are methods for extracting common compressed files under window, zip and. Rar,linux.
1) for. zip
Linux provides a zip and unzip program, ZIP is a compression program, unzip is the decompression program. They have a lot of parameter options, here are just a brief introduction, still examples of its use:
?
This command compresses all. jpg files into a zip package
?
This command is to extract all the files in the All.zip.
2) for. rar
To process. rar files under Linux, you need to install RAR for Linux, which can be downloaded from the Web, but remember that RAR for Linux is not free; available from http://www.rarsoft.com/download.htm download rarfor Linux 3.2.
0, then install:
?
123 |
# tar -xzpvf rarlinux-3.2.0.tar.gz # cd rar # make |
This installs well, after installation has RAR and unrar these two programs, RAR is the compression program, Unrar is the decompression program. They have a lot of parameter options, here are just a brief introduction, still examples of its use:
?
This command compresses all. jpg files into a RAR package named All.rar, which will automatically append the. rar extension to the package name.
?
This command is to extract all the files in the All.rar.
To this, we have introduced the Linux tar, gzip, gunzip, bzip2, bunzip2, compress, uncompress, zip, unzip, RAR, Unrar and other programs, you should already be able to use them to. tar,. GZ,. tar.gz,. tgz,. bz2,. tar.bz2,. Z,. Tar. Z,. zip,. rar 10 Kinds of compressed text
, you should not need to download a software and do not know how to solve Linux under the trouble. And the above methods are basically effective for UNIX.
This article describes the programs that are compressed under Linux, such as tar, gzip, gunzip, bzip2, bunzip2, compress, uncompress, zip, unzip, RAR, Unrar, and how to use them for. Tar,. GZ,. tar.gz,. tgz,. bz2,. tar.bz2,. Z. Tar. 10 compressed Files of Z,. zip,. rar
Operation.
The following additions
Tar
-C: Create compressed archives
-X: Unzip
-T: View content
-r: Append files to the end of a compressed archive file
-U: Update files in original compressed package
These five are stand-alone commands, which use one of the compression decompression, and can be used with other commands but only one. The following parameters are optional when compressing or extracting files as needed.
-Z: With gzip properties
-j: With the bz2 attribute
-Z: With the Compress attribute
-V: Show All procedures
-O: Unpack the file to standard output
The following parameter-F is required
-F: Use the file name, remember that this parameter is the last parameter, can only be followed by the file name.
?
12 |
# tar -cf all.tar *.jpg这条命令是将所有.jpg的文件打成一个名为all.tar的包。-c是表示产生新的包,-f指定包的文件名。 # tar -rf all.tar *.gif |
This command adds all the. gif files to the All.tar package. -R is meant to increase the file.
?
1 |
# tar -uf all.tar logo.gif |
This command is to update the original tar package All.tar in the logo.gif file,-U is to indicate the meaning of the update file.
?
This command is to list all the files in the All.tar package,-T is to list the meaning of the file
?
This command is to solve all the files in the All.tar package,-X is the meaning
Compression
TAR–CVF Jpg.tar *.jpg//package all JPG files in the directory into tar.jpg
TAR–CZF jpg.tar.gz *.jpg//pack all JPG files in the directory into Jpg.tar and compress them in gzip to generate a gzip compressed package named jpg.tar.gz
TAR–CJF jpg.tar.bz2 *.jpg//pack all JPG files in the directory into Jpg.tar and compress them in bzip2 to generate a bzip2 compressed package named jpg.tar.bz2
TAR–CZF jpg.tar.z *.jpg//pack all JPG files in the directory into Jpg.tar and compress them in compress to generate a umcompress compressed package named Jpg.tar.z
RAR a jpg.rar *.jpg//rar format compression, you need to download RAR for Linux first
Zip jpg.zip *.jpg//zip format compression, need to download zip for Linux First
Extract
TAR–XVF File.tar//Unpacking the TAR Package
TAR-XZVF file.tar.gz//Decompression tar.gz
TAR-XJVF file.tar.bz2//Decompression tar.bz2
TAR–XZVF file.tar.z//Unzip tar. Z
Unrar e file.rar//decompression rar
Unzip File.zip//Unzip zip
Summarize
1, *.tar with TAR–XVF decompression
2, *.gz with gzip-d or gunzip decompression
3, *.tar.gz and *.tgz with TAR–XZF decompression
4, *.bz2 with bzip2-d or with BUNZIP2 decompression
5, *.tar.bz2 with TAR–XJF decompression
6, *. Z Extract with Uncompress
7, *.tar. Z Extract with Tar–xzf
8, *.rar with Unrar e decompression
9, *.zip with unzip decompression
Linux decompression rar software download and decompression. zip and. rar files
: Http://www.rarsoft.com/download.htm (currently the latest RAR 3.71 for Linux)
Whichever is the latest.
For common compressed files under window, zip and. Rar,linux also have the appropriate methods to decompress them:
1: For. zip
Linux provides a zip and unzip program, ZIP is a compression program, unzip is the decompression program. They have a lot of parameter options, just a brief introduction, an example of how to use it:
?
12 |
# zip all.zip *.jpg(这条命令是将所有.jpg的文件压缩成一个zip包) # unzip all.zip(这条命令是将all.zip中的所有文件解压出来) |
2: For. rar
To process. rar files under Linux, you need to install RAR for Linux, which can be downloaded from the Web, but remember that RAR for Linux is not free; RAR 3 can be downloaded from http://www.rarsoft.com/download.htm. For Linux, then install its installation operation as follows:
?
123 |
# tar -xzpvf rarlinux-3.2.0.tar.gz # cd rar # make |
This installs well, after installation has RAR and unrar these two programs, RAR is the compression program, Unrar is the decompression program. They have a lot of parameter options, for example, to illustrate their usage
?
This command compresses all. jpg files into a RAR package named All.rar, which will automatically append the. rar extension to the package name.
?
This command extracts all the files in the All.rar.
The xxxx.tar.gz file uses the tar band ZXVF parameter, which can be unpacked at once. XXXX is the file name. For example:
?
Gzip-d
Syntax: gzip [-acdfhllnnqrtvv][-s < compress word tail string >][-< compression efficiency >][--best/fast][file ...] or gzip [-acdfhllnnqrtvv][-s < Compress tail string >][-< compression efficiency >][--best/fast][Catalog]
Additional Note: gzip is a widely used compression program, after which the file is compressed, and its name is followed by the extension ". Gz".
Parameters
-A or--ASCII uses ASCII text mode.
-C or--stdout or--to-stdout output the compressed file to a standard output device without making changes to the original file.
-D or--decompress or----uncompress unpack the compressed file.
-F or--force forcibly compresses the file. Ignores the existence of a file name or a hard connection and whether the file is a symbolic connection.
-H or--help online Help.
-L or--list lists information about the compressed file.
-L or--license displays version and copyright information.
-N or--no-name compresses a file without saving the original file name and time stamp.
-N or--name when compressing a file, save the original file name and time stamp.
-Q or--quiet does not display a warning message.
-R or--recursive recursively handles all files and subdirectories under the specified directory.
-s< compress the tail string > or----suffix< compress the tail string > change the compressed Word tail string.
-T or--test tests whether the compressed file is correct.
-V or--verbose displays the instruction execution process.
-V or--version displays version information.
-< Compression efficiency > Compression efficiency is a value between 1-9, the default value is "6", specifying the larger the value, the higher the compression efficiency. &NBSP
--best The effect of this parameter is the same as specifying the "-9" parameter. &NBSP
--fast The effect of this parameter is the same as specifying the "-1" parameter.
1, *.tar with TAR–XVF decompression
2, *.gz with gzip-d or gunzip decompression
3, *.tar.gz and *.tgz with TAR–XZF decompression
4, *.bz2 with bzip2-d or with BUNZIP2 decompression
5, *.tar.bz2 with TAR–XJF decompression
6, *. Z Extract with Uncompress
7, *.tar. Z Extract with Tar–xzf
8, *.rar with Unrar e decompression
9, *.zip with unzip decompression
Linux *.tar.gz File Decompression command
1. Compress the command:
Command format: TAR-ZCVF compressed file name. tar.gz Compressed file name
You can switch to the current directory first. Both the compressed file name and the compressed file name can be added to the path.
2. Unzip the command:
Command format: TAR-ZXVF compressed file name. tar.gz
The unzipped file can only be placed in the current directory.
You can use the zip command to work with multiple files and directories at the same time by listing them one after the other with a space interval:
Zip-r filename.zip file1 file2 file3/usr/work/school
Compress a single directory command zip-r filename.zip filename
The above command compresses the contents of the File1, File2, File3, and/usr/work/school directories (assuming this directory exists) and then puts them in the Filename.zip file.
Various decompression commands under Linux