tar extract command
tar
-C: Create compressed Archives
-x: Unzip
T: View content
-r: Append files to the end of the compressed archive
-u: Update the files in the original compressed package
These five are stand-alone commands that compress and decompress using one, and can be used with other commands but only one. The following parameters are optional when compressing or extracting files as needed.
-Z:
-j: With bz2 property
-Z: Compress properties
-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 , only the file name can be received later.
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,-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
commands from the network, I commonly used is. tar.gz Compression Package decompression, command:
Tar /file directory/filename. tar.gz /target directory/
Tar /mnt/data_10g/software/jdk-7u79-linux-x64.tar.gz /usr/local/java/
Extract the jdk-7u79-linux-x64.tar.gz from the/mnt/data_10g/software/directory to the/usr/local/java/directory
Centos6.5--Extract to the specified directory