Home  >  Article  >  php教程  >  Introduction to Linux decompression commands and usage of decompression commands

Introduction to Linux decompression commands and usage of decompression commands

高洛峰
高洛峰Original
2017-01-07 13:51:381516browse

1. Introduction to decompression command
tar command
-c: Create a compressed archive
-x: Decompress
-t: View the content
-r: Append to the end of the compressed archive file File
-u: Update the files in the original compressed package
These five are independent commands. One of them is used for compression and decompression. It can be used in conjunction with other commands but only one of them can be used. The following parameters are optional when compressing or decompressing archives as needed.
-z: With gzip attribute
-j: With bz2 attribute
-Z: With compress attribute
-v: Display all processes
-O: Unzip the file to Standard output
The following parameter -f is required
-f: Use the file name. Remember, this parameter is the last parameter, and can only be followed by the file name.
# tar -cf all.tar *.jpg This command will delete all. jpg files are packaged into a package named all.tar. -c means generating a new package, and -f specifies the file name of the package.
# tar -rf all.tar *.gif This command will delete all. The gif file is added to the all.tar package. -r means adding files.
# tar -uf all.tar logo.gif This command is to update the logo.gif file in the original tar package all.tar. -u means to update the file.
# The command tar -tf all.tar is to list all the files in the all.tar package, -t means to list the files
# The command tar -xf all.tar is to extract all. For all files in the tar package, -x means unpacking
2. Use the compression command
tar –cvf jpg.tar *.jpg //Package all jpg files in the directory into tar.jpgtar –czf jpg. tar.gz *.jpgtar –cjf jpg.tar.bz2 *.jpg
// Pack all the jpg files in the directory into jpg.tar, and compress them with gzip to generate a gzip-compressed package, named For jpg.tar.gz

//Package all the jpg files in the directory into jpg.tar, and compress them with bzip2 to generate a bzip2 compressed package named jpg.tar.bz2tar – cZf jpg.tar.Z *.jpgrar a jpg.rar *.jpg
//Package all jpg files in the directory into jpg.tar, and compress them with compress to generate a umcompress compressed package, named For jpg.tar.Z

//rar format compression, you need to download rar for linuxzip jpg.zip *.jpg
//zip format compression, you need to download zip for linux first
3. Use the decompression command
tar –xvf file.tar //Extract tar package tar -xzvf file.tar.gz //Extract tar.gztar -xjvf file.tar.bz2 //Extract tar.bz2tar –xZvf file. tar.Z //Extract tar.Zunrar e file.rar //Extract rarunzip file.zip //Extract zip IV. Summary
1. Use tar –xvf to decompress *.tar
2. Use gzip for *.gz -d or gunzip to decompress
3, *.tar.gz and *.tgz, use tar –xzf to decompress
4, *.bz2, use bzip2 -d or bunzip2 to decompress
5, *.tar.bz2 Use tar –xjf to decompress
6, *.Z Use uncompress to decompress
7, *.tar.Z Use tar –xZf to decompress
8, *.rar Use unrar e to decompress
9, *. zip Use unzip to decompress


For more articles about the introduction of Linux decompression commands and the use of decompression commands, please pay attention to the PHP Chinese website!


Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn