centos7 tar.gz zip unzip command

responsible for packing tar, gzip compression in charge

tar
-c: establish compressed file
-x: unzip
-t: view the contents
-r: append to the archive file
-u: update the original file compression package

The five independent command, should be used where a compression decompression can be used in conjunction with other commands, but can only use one of them. The following parameters are required when optional file compression or decompression.

-z: gzip attribute has
-j: There bz2 attribute
-Z: There compress attribute
-v: show all processes
-O: to standard output file will unlock

The following parameters are necessary -f

-f: Use file name, remember, this parameter is the last parameter, behind only access the file name.

tar -cf all.tar * .jpg

This command is all .jpg files labeled as a package called all.tar. -c is to generate new packages, -f specify the package file name.

takes -rf all.tar * .gif

This command is all. .Gif files added all.tar package to go inside. -r is meant to increase the file.

tar -uf all.tar logo.gif

This command is to update the original tar package all.tar the logo.gif file, -u is the meaning of the update file.

takes -tf all.tar

This command is to list all the files all.tar package, -t is the meaning of the listed files

takes -xf all.tar

This command is solved all.tar package all the files, -x is to unlock the meaning of

Compressed
tar -cvf jpg.tar * .jpg // directory where all jpg files into tar.jpg
after tar -czf jpg.tar.gz * .jpg // directory to package all jpg files into jpg.tar, and its use gzip compression to generate a gzip compressed package named jpg.tar.gz
after tar -cjf jpg.tar.bz2 * .jpg // directory to package all jpg files into jpg.tar, and its with bzip2 compression, to generate a bzip2 compressed packages, jpg.tar.bz2 named
after tar -cZf jpg.tar.Z * .jpg // directory to package all jpg files into jpg.tar, and compress it with compression, to generate a umcompress compressed package named jpg.tar.Z
RAR a jpg.rar compressed * .jpg // rar format, you need to download for Linux RAR
ZIP jpg.zip ZIP // * .jpg format compression, you need to download the zip for linux

Extracting
tar -xvf file.tar // extract the tar archive
tar -xzvf file.tar.gz // unpack tar.gz
tar -xjvf file.tar.bz2 // unpack tar.bz2
tar-xzvf file.tar.Z // extracting the tar.Z
unrar E // file.rar extracting RAR
the unzip // extract the zip file.zip

Summarized
. 1, .tar codecs with tar -xvf
2,
.gz using gzip -d or gunzip it
. 3, .tar.gz and .tgz with tar -xzf codecs
. 4, the .bz2 with bunzip2 it with bzip2 -d or
5,
. tar.bz2 tar -xjf with decompression
. 6, .Z uncompress with decompression
. 7,
.tar.Z with tar -xZf codecs
. 8, .rar extracting with unrar e
. 9,
.zip unzip it with

Guess you like

Origin www.cnblogs.com/jingzaixin/p/11495667.html