Compression Decompression Command:
----------. GZ----------
1. Compression
Gzip[gnu Zip]:/bin/gzip
Format: gzip option [ file ]#压缩文件, Zip extension . gz, most commonly used under Linux #比较常见的软件源代码包的格式
Features:1) can only compress files, cannot compress the directory
2) do not retain the original document
E.g.gzip newfile# Original newfile Delete
2. Decompression
1) Gunzip[gnu zip]:/bin/gunzip
2) gzip-d# unzip . GZ
e.g.
Gzip-d newfile.gz
----------. Tar----------
3. compression
Tar:/bin/tar
#打包目录, package the directory into a file, generate . Tar, and if you compress it at this point, it will generate . GZ
Format: tar [ option CVF] [ compressed filename] [pre- compress file / directory name ]
-C: generate a package file for . Tar , mandatory option
-V: Show more information
-F: set the compressed file name, required option
-Z: package compression at the same time
E.G.TAR-CVFZ dir1.tar.gz dir1# to package dir and compress it into a single file
[Note-This one step packaging and compression is not supported by all UNIX Systems! ]
At this time: 1) Packing:tar-cf Newdir.tar newdir
2) Compression:gzip Newdir.tar#或者用连接符.
4. Decompression
tar [ options ]:
-X Unpack the . Tar file
-V Show More information
-F Specify Unzip file
-Z Decompression
E.G.TAR-ZXF newdir4.tar.gz
Step Gunzip newdir.tar.gz
TAR-XVF Newdir.tar
----------. Zip----------
5.Zip:/usr/bin/zip
The default Windows and Linux are the only common format , so if the file is small, we recommend using the. zip
Format: Zip [ option - R] [ compressed filename ] [ file / directory name before compression ]
e.g.zip services.zip/etc/services compressed Files
Zip-r newdir.zip Test Compression directory
Zip up the Two major defectsof gzip: 1) Keep source files
2) can compress the directory
6,unzip/usr/bin/unzip
Example: Unzip newdir.zip# keep the original file
----------. bz2----------
7,bzip2/usr/bin/bzip2
#相当与gzip upgrade , the compression ratio is amazing , but still cannot compress the directory , the compressed file name . bz2, Of course, it can be combined with tar .
Format: bzip2 option [-K] [ file name ]#加- k keep the source file, or zip Same
8,bunzip2
You can use-K to preserve source compressed files
Linux Common Commands (second edition)--Compression decompression command