Original link
Http://www.cnblogs.com/qq78292959/archive/2011/07/06/2099427.html
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.
# 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.
# TAR-RF All.tar *.gif
This command adds all the. gif files to the All.tar package. -R is meant to increase the file.
# 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.
# TAR-TF All.tar
This command is to list all the files in the All.tar package,-T is to list the meaning of the file
# TAR-XF All.tar
This command is to solve all the files in the All.tar package,-T is to untie 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
# Note that the file name after parameter f is taken by yourself, and we are accustomed to using. Tar as a recognition.
# if the z parameter is added, the. tar.gz or. tgz represent the gzip compressed tar file ~
# If you add the J parameter, use. tar.bz2 as the file name.
# When the above instruction is executed, a warning message is displayed:
# "tar:removing leading"/"from member names" That's a special setting for absolute paths
Unzip
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
# Note that it is best to jump to the directory where the file is located before extracting the file and not include the path name, otherwise the extracted target file may be generated in a subdirectory.
(go) Compress and unzip files using the Linux tar command