File compression and packaging under Linux

Source: Internet
Author: User
Tags bz2 rar

The compressed package file format on Linux, in addition to Windows most common *.zip, *.rar,. 7z suffix for compressed files, as well as. GZ,. XZ,. bz2,. Tar,. tar.gz,.tar.xz,tar.bz2

File Suffix Name description

*.zip zip program packing compressed files

*.rar RAR Program Compressed files

*.tar Tar program packaging, uncompressed files

*.gz gzip Program (GNU Zip) compressed files

*.XZ XZ Program Compressed files

*.BZ2 tar packaging, gzip program compressed files

*.targz tar packaging, gzip program compressed files

*.tar.xz tar package, XZ program compressed files

*.TAR.BZ2 tar package, BZIP2 program compressed files

*.tar.7z tar package, 7z program compressed files

    • Compress

Using compress to compress source files will be overwritten

File suffix:. Z

-C Prints the result to the screen, and the compressed file displays garbled characters.

With redirection, the original file is not overwritten, but the permissions change, the nature of the redirect is to create a new file, and the permissions of the new file are related to the Umask value

-F default does not have a hard-link number of 2 and above file compression, plus F, forcing the compression of the specified file, and other files with the inode hard links minus 1.
-V shows the detailed procedure.

Such as

Unzip-D

Uncompress

Zcat x.z > X Unzip the file into the current directory and keep the source file

    • . zip

Unzip decompression
|zip the file name that will be generated-
You can convert the output before the pipeline to a file and compress it. Files compressed in this way can only be decompressed using "unzip-p Package > New File"

Extract:

The Pwd4 file is the same size as the PWD file, confirming this command.


Unzip-p Preview the extracted content to the screen, you can configure the redirection to save the results to the specified file, and the permissions change.

Zip-r new file name. zip compressed packaged files (can be multiple files)

    • Gzip
      Suffix:. gz

      -C Prints the results to the screen, with redirection, without overwriting the original file, but the permissions change.
      -F default does not have a hard-link number of 2 and above file compression, plus F, forcing the compression of the specified file, and other files with the inode hard links minus 1.
      -V shows the detailed procedure.
      The larger the-# number, the higher the compression ratio, and the slower the file size becomes.


-1 equals--fast

-2,3,4,5,6 (default), 7,8
-9 equals--best

Unzip

-D
Gunzip
Zcat x.gz > X

    • Bzip2
      . bz2

      -K Keep the original file
      -C Prints the results to the screen, with redirection, without overwriting the original file, but the permissions change.
      -F default does not have a hard-link number of 2 and above file compression, plus F, forcing the compression of the specified file, and other files with the inode hard links minus 1.
      -V shows the detailed procedure.
      The larger the-# number, the higher the compression ratio, and the slower the file size becomes.
      -1 equals--fast
      -2,3,4,5,6,7,8
      -9 equals--best (default)

Unzip

-D
Bunzip
Bzcat x.bz2 > X

    • Xz
      . XZ

      -K Keep the original file
      -F default does not have a hard-link number of 2 and above file compression, plus F, forcing the compression of the specified file, and other files with the inode hard links minus 1.
      -V shows the detailed procedure.
      The larger the-# number, the higher the compression ratio, and the slower the file size becomes.
      -0 equals--fast
      -1-2,3,4,5,6 (default), 7,8
      -9 equals--best

Unzip

-D
Xzcat

Similar to the gzip command.

    • Tar

-CF Create Package name original file (multiple can be specified)

-TF Package Name shows the file name in the package

-TVF detailed display of file names in packages

-RF Package Name new file name (multiple can be specified)
--DELETE-F Package name deleted file name (multiple can be specified)

-XF Package name to extract all files to the current directory

The source file is deleted and then extracted from the package.

-XF Package name File name solution to the current directory of the specified files
-C unpacking to the specified directory
-V Display procedure
-JCF Create the package name (. tar.xz) Original file (can specify multiple) package and use XZ compression
-JCF Create Package name (. tar.bz2) Original file (can specify multiple) package and compress with bZIP
-ZCF Create Package name (. tar.gz) Original file (multiple can be specified) package and gzip compress

-t specifies a list that contains the files that need to be packaged, separated by a newline character
-x specifies an exclusion list, with a newline character as the interval

This article simply lists some of the compression tools and their applications in Linux.

File compression and packaging 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.