Summary of various types of compressed file commands under Linux

Source: Internet
Author: User
Tags bz2 gz file rar uncompress

. tar
Unpacking: Tar xvf Filename.tar after unpacking the original file still exists
Package: Tar cvf filename.tar DirName1 Filename1 ...
List contents: Tar TVF Filename.tar
(Note: Tar is packaged, not compressed!) )
———————————————
. gz
Extract 1:gunzip filename.gz after unpacking the original file disappears
Extract 2:gzip-d filename.gz after unpacking the original file disappears
Compression: gzip FileName (only for single file compression)
List contents: Gzip-l 5314-gz-1.gz

. tar.gz and. tgz
Decompression: Tar zxvf FileName.tar.gz after unpacking the original file still exists
Compression: Tar zcvf FileName.tar.gz DirName
List contents: Tar TVF FileName.tar.gz gzip-l 5314-gz-1.gz
———————————————
. bz2
Extract 1:bzip2-d filename.bz2 after unpacking the original file disappears
Extract 2:bunzip2 filename.bz2 after unpacking the original file disappears
Compression: Bzip2-z FileName

. tar.bz2
Decompression: Tar jxvf FileName.tar.bz2 after unpacking the original file still exists
Compression: Tar jcvf FileName.tar.bz2 DirName
———————————————
. BZ
Extract 1:bzip2-d filename.bz after unpacking the original file disappears
Extract 2:bunzip2 filename.bz after unpacking the original file disappears
Compression: Unknown

. tar.bz
Decompression: Tar jxvf FileName.tar.bz after unpacking the original file still exists
Compression: Unknown
———————————————
. Z
Decompression: uncompress filename.z
Compression: Compress FileName
. Tar. Z

Decompression: Tar zxvf filename.tar.z
Compression: Tar zcvf filename.tar.z DirName

———————————————
. XZ
Decompression: uncompress filename.z
Compression: Compress FileName
. Tar. Z

Decompression: Tar zxvf filename.tar.z
Compression: Tar zcvf filename.tar.z DirName

———————————————
. zip
Decompression: Unzip Filename.zip
Compression: Zip Filename.zip DirName
———————————————
. rar
Decompression: rar x Filename.rar
Compression: rar a Filename.rar DirName
———————————————
. Lha
Decompression: Lha-e Filename.lha
Compression: Lha-a Filename.lha FileName
———————————————
. rpm
Unpacking: Rpm2cpio filename.rpm | Cpio-div
———————————————
. deb
Unpacking: ar p filename.deb data.tar.gz | Tar zxf-
———————————————
. Tar. tgz. tar.gz. Tar. Z. tar.bz. tar.bz2. zip. cpio. Arj. rar. Ace. Lha. Lzh. Lzx. Lzs., Arc. SDA. SFX. Lnx. Zoo. cab. Kar. cpt. P it. Sit. Sea
Decompression: sEx x filename.*
Compression: SEx a filename.* FileName

Sex just call the relevant program, itself and no compression, decompression function, please note!

gzip command
There are two obvious benefits of reducing file size, one is to reduce storage space, and the other is to reduce transmission time when transferring files over the network. Gzip is a frequently used Linux system command to compress and decompress files, which is both convenient and useful.

Syntax: gzip [options] File name for compression (decompression) The options for this command have the following meanings:

-C writes the output to the standard output and retains the original file. -D Unzip the compressed file. -L Displays the following fields for each compressed file: The size of the compressed file, the size of the uncompressed file, the compression ratio, the name of the uncompressed file-R recursively finds the specified directory and compresses all of its files or is decompressed. -T test to check that the compressed file is complete. -V for each compression and decompression file, display the filename and compression ratio. -num adjusts the speed of compression with the specified number num,-1 or--fast represents the fastest compression method (low compression ratio), 9 or--best represents the slowest compression method (high compression ratio). The system default value is 6. instruction Example:

Gzip *% compress each file in the current directory into a. gz file. GZIP-DV *% extracts each compressed file in the current directory and lists detailed information. Gzip-l *% Detail shows the information of each compressed file in Example 1, and does not understand the pressure. Gzip usr.tar% compress the tar backup file Usr.tar, at which time the compressed file has a. tar.gz extension.

Summary of various types of compressed file commands under Linux

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.