Linux compression and decompression tools

Source: Internet
Author: User

compression, compression, and archiving tools

Some properties may be lost when compressing files, and ACL properties will be lost

The following are the tools used to compress a single file

Compress "files to compress" (the original file is deleted by default)

-D decompression, equivalent to uncompress

-C results output to standard output without deleting files

-V Show Details

Uncompress decompression

Zcat file. Z > file (actually equivalent to putting file. Z file is opened and then extracted to files)


Gzip[option].. FILE ... (The source file is deleted by default)

-D: Unzip

-C: Output compressed or decompressed results to the screen

-"number": 1-9, specify the compression ratio, the greater the value of the compression ratio, the default compression ratio of 6

Gzip-c File > file.gz (save file and compress to file.gz)

Zcat file.gz > file (Unzip the file.gz

Gunzip file.gz Decompression


Bzip2[option].. FILE ... (The source file is deleted by default)

-K: Keep source files

-D: Unzip

-"number": 1-9, compression ratio, default compression ratio is 9

BUNZIP2 file.bz2 Decompression

Bzcat Viewing Compressed file contents


Xz[option] ... FILE ...

-K: Keep source files

-D: Unzip

-"number": 1-9, compression ratio, default is 6

Xzcat Viewing Compressed file contents


Zip compressible folder:

Package Compression:

Zip-r Sysconfig/etc/sysconfig (/etc/sysconfig compression to the current directory named Sysconfig)

Unpacking and Decompression:

Unzip Sysconfig.zip

Unzip-p filename.zip > file (the result of extracting the zip file into a new file)


Tar tool, a packaging tool:

Tar[option] ...

-C: Create a packaged file to specify the file suffix, tar

-F: To which location to package the files

-V: View the packaging process

For example: Tar-cvf/app/sysconfig.tar/etc/sysconfig (Pack/etc/sysconfig into/app Sysconfig.tar)


-r: Chasing new files and adding to packaged files

-T: View content in packaged files

-X: Unpack the package file

-C: Specify to unpack to the specified directory

-T: Packaging multiple catalogs into a single. tar file, editing a file, writing the directory path that needs to be packaged, and then using Tar-t "edited file name"-ZCVF "file.tar.gz" to read the contents of the created file directly, To package multiple directories into a single file


Cutting:

Split can cut a large tar file into multiple small files:

Split-b "Cut Size"-D "to differentiate files with numbers" "prefix name" (The cut file name is cut by the specified size, and the name is the specified prefix name, and the prefix name is followed by a number of files)


Restores:

Restore the cut file to a tar file: Cat "cut All Files" > "A new File"


The TAR command can be implemented with the Compression tool: Package and compress

-j:bzip2-z:gzip-j:xz


Cpio: The file can be packaged, restored, and in a specific mode, can be copied from somewhere, or the processed data is placed in an archive, and the packaged file suffix is typically cpio or tar

Options:

-O: Package files into a file to redirect to the device

-I: Unpacking multiple files to a location

-T: Preview to view data in packaged files

-V: Display procedure

-D: Unpacking will automatically generate the directory, default

-C: Make new storage format

For example: Find/etc-print | Cpio-ov > Etc.cpio (Find the file under etc in the current directory and package it as a Etc.cpio file)

Cpio-tv < Etc.cpio (preview files in Etc.cpio)

Unpacking: Cpio-idv < File.cpio (default solution in current directory) Cpio-idv "file to be solved separately" < "File.cpio" (Unpacking a file in File.cpio separately)


Linux compression and decompression tools

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.