Linux Learning Notes < 13 >--file compression, decompression, and archiving

Source: Internet
Author: User
Tags uncompress

Compression, decompression command:

1.compress/uncompress: The compression format is z and the file suffix is. Z

Compress/path/to/file

Uncompress/path/to/file. Z


2.GZIP/GUNZIP/ZCAT: The compressed format is GZ and the file suffix is. gz

gzip [OPTION]/path/to/file: The compressed file is saved in the directory of the compressed file, and the original file is deleted when the compression is complete.

-v|verbose: Show instruction execution process

-D: Unzip, delete the original compressed file after decompression is complete

-#:1-9, specify the compression ratio, default is 6, the higher the number, the higher the compression ratio, the longer the time

Gunzip/path/to/file.gz: Remove the original file after extracting Wencheng

Zcat/path/to/file.gz: To view the contents of a text file without being pressed


3.bzip2/bunzip2/bzcat: Compression format of bz2, larger compression ratio than gzip, using format approximation

bzip2 [OPTION]/path/to/file

-v|verbose: Show instruction execution process

-K: Preserve the original file when compressing or decompressing

-D: Unzip

-#:1-9, default is 6

bunzip2/path/to/file.bz2

bzcat/path/to/file.bz2


4.xz/unxz/xzdec/xzcat: The compression format is XZ

XZ [OPTION]/path/to/file

-#: 1-9, default is 6

-K: Keep the original file when compressing

-D: Unzip

Unxz|xzdec/path/to/file.xz

Xzcat/path/to/file.xz


5.zip: A tool that can be archived and compressed

Zip file.zip file1 file2 ... : The original file is not deleted after default compression

-r:recurse all files within the directory are compressed, zip-r foo.zip foo

-v|verbose: Show instruction execution process

Unzip File.zip

-v|verbose: Do not compress display file list



Archive (Pack) command:

Tar: The file format is. tar

-C: Create an archive file

-f:file.tar: Archived files for operations

-X: Expand Archive

--xattrs: Preserve extended attribute information for files while archiving

-T: View archived file list directly without expanding the archive


-ZCF file.tar.gz: Archive and invoke gzip compression

-ZXF file.tar.gz: Call gzip to unzip and expand Archive,-Z option to omit


-JCF file.tar.bz2: Archive and call bzip2 compression

-JXF file.tar.bz2: Call bzip2 extract and expand archive


-JCF FILE.TAR.XZ: Archive and call XZ compression

-JXF FILE.TAR.XZ: Call XZ to unzip and expand archive



Linux Learning Notes < 13 >--file compression, decompression, and archiving

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.