Introduction to gzip, BZIP2, zip, unzip, tar usage in Linux

Source: Internet
Author: User
Tags bz2 gz file rar

Compression Decompression Command Introduction
. GZ compression to gzip files
. bz2 compression to bzip2 file
. tar package files, merging multiple files into one directory
. tar.gz first into a tar package, then compressed to gzip file
. tar.bz2 first into a tar package, then compressed into a bzip2 file
. Tar. Z first into a tar package, then compressed to Z file
. rar
Compress to RAR file
Compressed rar a *.rar file
Unzip Unrar e *.rar

. zip
Compress to zip file
Compressing zip *.zip files
Decompression Unzip *.zip

1) gzip
Format:
gzip [-ACDFHLLNNRTVV19] [-s suffix] [--rsyncable] [name ...]
Gunzip [-ACFHLLNNRTVV] [-s suffix] [name ...]
Zcat [-FHLV] [name ...]

Example: Cannot compress the directory
gzip [-d#] File name-D decompression using # compression level 1~9,6 as default, 9 best


2) bzip2
Format:
bzip2 [-cdfkqstvzvl123456789] [filenames ...]
BUNZIP2 [-FKVSVL] [filenames ...]
Bzcat [-S] [filenames ...]
Bzip2recover filename

Example: Cannot compress the directory
bzip2 [-dz] File name-D decompression when using-Z compression is used

3) Tar
Example:
tar [-ZJXCVFPP] File name
-Z Compression with gzip
-j compression with bzip2
-X Unpacking or decompressing
-T view the files in the tar package
-C Build a tar package or compressed package file
-V Output compressed or uncompressed information
-F compression, the file name is compressed, and when decompressed, for the filename to decompress, use the-f,-f parameter in the last
-P compression preserves file attributes before compression
--exclude file or directory to exclude when file name is compressed or packaged

View a list of files for a package or compressed package
TAR-TF *.tar.gz

Package and compress into. tar.gz files
TAR-ZCVF *.tar.gz directory or file name

Unzip the. tar.gz file
TAR-ZXVF *.tar.gz

Package and compress into. tar.bz2 files
TAR-JCVF *.tar.bz2 directory or file name

Unzip the. tar.bz2 file
TAR-JXVF *.tar.bz2

. tgz
Decompression: Tar zxvf filename.tgz
Compression: Tar zcvf filename.tgz FileName

. tar.tgz
Decompression: Tar zxvf FileName.tar.tgz
Compression: Tar zcvf FileName.tar.tgz FileName

Introduction to gzip, BZIP2, zip, unzip, tar usage in Linux

Related Article

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.