Linux compression and decompression commands (gizp, tag, zip, bzip2)

Source: Internet
Author: User
Tags unpack

Linux compression and decompression commands (gizp, tag, zip, bzip2)

-------------------------------------- Compression and decompression command -------------------------------

* Windos can decompress all linux System File packages, but linux may not be able to decompress all of windos's
I. gzip: compressed file --- GUN zip. gz File Format
Features: 1. Only files can be compressed and directories cannot be compressed.
2. Do not retain source files
Example: gzip newfile will upload a newfile.gz file package
Gunzip: Decompress (or use gzip-d)
Example: gunzip newfile.gz

Tar: compression and decompression command
Features: Packaging directory (package the Directory into a file)
-C producer .tar package the file
-V: Show Details
-F: Specifies the compressed file name.
-Z package and compress (not supported by the old unix System)
Example: tar-zcf leyangjun.tar.gz filedir --> package filedirinto leyangjun.tar.gz

2: tar-cf newdir.tar newdir --> press it into a tar package
Gzip newdir.tar --- sit-down Compression
The above two steps are equivalent
Tar-zcvf newdir.tar.gz newdir
Ii. tar: unpack
-X unpack the .tar File
-V: Show Details
-F: Specifies the file to be decompressed.
-Z Decompression
Tar-zxf newdir.tar.gz === gunzip newdir.tar.gz --> tar-xf newdir.tar
3. zip (applicable to winds and linux)
Features: files can be compressed or directories can be compressed.
The original file is retained.
The compressed directory is added with-r
Example: zip new.zip new: compress the newfile into new.zip (this will show the compression ratio progress)
Zip-r newdir.zip newdir (compress into newdir.zip without the suffix name is also OK, add is good identification)
Unzip: Extract
Unzip newdir.zip

Iv. bzip2 (an upgraded version of gzip), all compressed files
Features: Suitable for compressing large files
-K keep source files
Example: bzip2-k newfilw2 (compress the newfile2 file and-k retains the source file)
Bunzip2:
Bunzip2 newfile2.bz2
Bunzip2-k newfile2.bz2 (source compressed files are retained)

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.