Linux Compression Decompression Command detailed

Source: Internet
Author: User
Tags rar uncompress zip extension

Linux Extract File Set

Tar

Unpacking: Tar xvf filename.tar

Packaging: tar cvf filename.tar DirName

(Note: Tar It's packing, not compression! )

———————————————

. gz

Unzip 1 : gunzip filename.gz

Unzip 2 : gzip-d filename.gz

Compression: gzip FileName

. tar.gz and. tgz

Decompression: Tar zxvf FileName.tar.gz

Compression: Tar zcvf FileName.tar.gz DirName

———————————————

. bz2

Unzip 1 : bzip2-d filename.bz2

Unzip 2 : bunzip2 filename.bz2

Compression: bzip2-z FileName

. tar.bz2

Unzip: tar jxvf FileName.tar.bz2 or tar–bzip xvf FileName.tar.bz2

Compression: tar jcvf FileName.tar.bz2 DirName

———————————————

. BZ

Unzip 1 : bzip2-d filename.bz

Unzip 2 : bunzip2 filename.bz

Compression: Unknown

. tar.bz

Unzip: tar jxvf FileName.tar.bz

Compression: Unknown

———————————————

. Z

Unzip: uncompress filename.z

Compression: Compress FileName

. Tar. Z

Unzip: Tar zxvf filename.tar.z

Compression: tar zcvf filename.tar.z DirName

———————————————

. zip

Unzip: Unzip Filename.zip

Compression: zip filename.zip DirName

Compress a directory using the-r parameter,-R recursion. Example: $ zip-r filename.zip DirName

———————————————

. tar.xz

Unzip: 1) First use xz-d xxx.tar.xz to extract into Xxx.tar

2) TAR-XVF Xxx.tar decompression

Compression:

———————————————

. rar

Unzip: rar x Filename.rar

Compression: rar a filename.rar DirName

After extracting, copy the rar_static to the/usr/bin directory (other directories specified by the $PATH environment variable are also available):

[email protected] tmp]# CP Rar_static/usr/bin/rar

Common file decompression methods and commands under Linux

System System

1. A file with an extension of. A:

#tar XV File.a

2. Files with a. z Extension:

#uncompress file. Z

3. Files with the extension of. GZ:

#gunzip file.gz

4. Files with the extension of. BZ2:

#bunzip2 file.bz2

5. Files with the extension of. Tar.z:

#tar Xvzf File.tar.z

or #compress-dc File.tar.z | Tar xvf

6. Files with the extension of. Tar.gz/.tgz:

#tar Xvzf file.tar.gz

or gzip-dc file.tar.gz | tar xvf-

7. Files with the extension of. TAR.BZ2:

#tar xvif file.tar.bz2

or BZIP2-DC file.tar.bz2 | xvf-

8. Files with the extension of. Cpio.gz/.cgz:

#gzip-DC File.cgz | Cpio-div

9. Files with the extension of. Cpio/cpio:

#cpio-div File.cpio

or CPIO-DIVC File.cpio

10. Install files with an extension of. RPM:

#rpm-I. file.rpm

File.deb data.tar.gz | Tar Xvzf-

14. Files with a. zip extension:

#unzip File.zip

COMPRESS-DC File.tar.z | Tar xvf-

x It's decompression .

v is a complex output

F is the specified file

Z gz format

Gzip

gzip[ options ] the file name to compress (or decompress)

- C writes the output to the standard output and retains the original file.

- D compresses 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
The name of the compressed file

-R recursively finds the specified directory and compresses or compresses all of its files.

The-t test compressed file is just intact.

-V for each compressed and uncompressed file, display its file name and compression ratio.

-num-adjusts the speed of compression with the specified number.

Example:

Make a backup of all files in the/usr directory, including its subdirectories, with the backup file named Usr.tar

Tar cvf usr.tar/home

Make a backup and compress all the files in the/USR directory and include its subdirectories, and the backup file name is USR
. tar.gz

Tar czvf usr.tar.gz/usr

Compress a set of files with a suffix of tar.gz

#tar CVF back.tar/back/

#gzip-Q Back.tar

Or

#tar CVFZ back.tar.gz/back/

Releases a file with a suffix of tar.gz.

#tar ZXVF back.tar.gz

#gzip back.tar.gz

#tar XVF Back.tar

Tar file directory Hit (solution) package

gzip Compress (unzip), suffix name is "GZ"

Compress Ibid . , the suffix name is "Z"

bzip2 The above suffix is "Bz2″

Common tar commands under Linux call each compression software for packaging and decompression

Tar common

-CVF Packing ,-XVF Unpacking ,-TF View the contents of the package, which is three basic usage and can be added to other parameters to
Call other software to implement packaging and decompression, such as calling the Gzip tool

-ZCVF,-ZXVF,-ZTF For example: TAR-ZCVF myball.tar.gz Mydir put Mydir Directory with gzip work
Packaging, so our suffix is in gz, so we know what the tool is packaged, and we also use the corresponding
Unpack,tar-zxvf myball.tar.gz Unzip in the current directory and look at the same thing .

TAR-ZTF myball.tar.gz

such as call compress, its suffix name is Z, if we see such a compressed package myball.tar.z, then I
We can decompress tar-zxvf myball.tar.z View and package and similar to the above,

If you call the Bzip2 tool, its suffix is bz2, and if we're going to package a file then this

TAR-JCVF myball.tar.bz2 myfile

Look at the above you should have a general grasp: remember

-CVF is packing

-XVF It's unpacking .

-TF is to view the contents of the package

Call the relevant tool, just add a parameter to the front.

gzip Plus Z the suffix name is GZ

Compress Plus Z suffix name Z

bzip2 Plus J the suffix name is bz2

Linux files and suffix names are not related

Linux Compression Decompression Command detailed

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.