Server migration, so you need to copy the files on their virtual machine to local, because the file is too large, so compression, review the TAR command
1:tar Introduction
-C: New packaging files can be paired with-V to see the process of the file name (fileName)-X: Unpacking or decompression function, can be used with-C (uppercase) in a specific directory to unlock-t: View the contents of the packaged file contains those file names, Focus on viewing the file name-r: Append file to the end of the compressed archive-u: Update the files in the 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: Compression/decompression via gzip support, at this time the file name is preferably *.TAR.GZ-J: compression/Decompression through BZIP2 support, at this time the filename is best *.tar.bz2
-f:filename, after the file name to be processed. Suggested-F is written separately as a parameter
-C: Directory, this parameter can be used to decompress a specific directory at the time of decompression.
2:tar Basic Applications
# 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 package 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 package All JPG files in the directory into Jpg.tar, and then compress them in bzip2 to generate a bzip2 compressed package named jpg.tar.bz2
- TAR–CZF jpg.tar.z *.jpg package All JPG files in the directory into Jpg.tar, and then 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, you need to download the 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
- Unrar e file.rar decompression rar
- Unzip File.zip Unzip zip
Summarize
- *.tar Decompression with TAR–XVF
- *.gz extract with gzip-d or gunzip
- *. tar.gz and *.tgz with TAR–XZF decompression
- *. bz2 with bzip2-d or with BUNZIP2 decompression
- *.TAR.BZ2 Decompression with TAR–XJF
- *. Z Extract with Uncompress
- *.tar. Z Extract with Tar–xzf
- *.rar with Unrar e decompression
- *.zip decompression with unzip
Linux command (TAR)