Common compression commands on Linux gzip,bzip2,zip/unzip__linux

Source: Internet
Author: User
Tags bz2 gz file
Common compression commands on Linux Gzip,bzip2,zip/unzip

1. Gzip


Gzip-generated compressed file is *.gz
Format: gzip [-cdtv#] File
Main parameters:
-C: Output compressed data to the screen
-D: Decompression
-T: Used to verify if there are any errors in the compressed file
-V: Displays the compression ratio of the original file/compressed file case
-#: Compression level,-1 the fastest, but the compression ratio is the worst;-9 slowest, but the compression ratio is the best; preset is-6
Note: When using gzip to compress, the original file will be compressed into a. gz file name, and the source file will no longer exist.

Example
Compression:
Gzip Te
Compress the file te to te.gz and delete the file Te

Extract:
Gzip-d te.gz
Unzip the file te.gz to TE while deleting the file te.gz

------ZCAT Command


Format: Zcat file
The Zcat command can be used to read the contents of the. GZ compressed file
Zcat te.gz
Read the contents of the te.gz

2. bzip2
BZIP2 The resulting compressed file is *.bz2
Format: bzip2 [-cdkzv#] File
Main parameters:
-C: Output data from the compressed process to the screen
-D: Decompression
-K: Keep the source file without deleting the original file
-Z: Compressing
-V: Can display information such as the compression ratio of the original file/compressed file
-#: Compression level,-1 the fastest, but the compression ratio is the worst;-9 slowest, but the compression ratio is the best; preset is-6

Example
Compression:
Bzip2 te

Compress the file te to te.bz2 and delete the file Te


Bzip2-k te
to compress file Te to te.bz2, keep the file Te

Extract:
gzip-d te.bz2
Extract file te.bz2 to TE and delete files te.bz2

GZIP-KD te.bz2
Extract the file te.bz2 to TE while preserving the file te.bz2

------bzcat Command

Format: Bzcat file
The Bzcat command can be used to read the contents of the. bz2 compressed file
Bzcat te.bz2
Reads the contents of the TE.BZ2

3. Zip/unzip
Zip is the mainstream compression format under window, here is a brief introduction to

Format: Zip zipfile (. zip) file
compresses files to Zipfile.zip and preserves file files

Format: Unzip File.zip
Extract file File.zip, keep file File.zip

Example
Compress:
Zip te te
compress file te to Te.zip, keep file Te

Extract:
Unzip Te.zip
Extract the file Te.zip (the extracted file name can be renamed) while retaining the file Te.zip

Zip/unzip There are a bunch of other parameters, you can use the Man command to view


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.