4_linux_ file compression and decompression instructions

Source: Internet
Author: User
Tags tar unzip

3.4 Compression decompression command. gz. tar.gz. zip. bz2

1) Gzip Compress files only

The gzip command is used to compress the file, the English original is the GNU Zip, where the path/bin/gzip, the syntax format is:

gzip [file]

The compressed file format is. gz.

Note:

1 only files can be compressed

2 Do not retain the original document

?

2) Gunzip

Unzip gunzip [compressed file] or Gzip–d [compressed file]

3) Tar compressed files and directories

The tar command is used to package the directory , where the path is/bin/tar, in the syntax format:

Tar options [-ZCF] [file name after compression] [table of contents]

Where the-c option means packaging; the-v option indicates that details are displayed, the-F option specifies the file name, and the-Z option means that the package is compressed at the same time, and the compressed file format is. tar.gz or. tgz

TAR–ZCVF dir.tar.gz [file or directory to be compressed]

?

Note: file+ file: View file type directives

Type + directive: View instruction Type

?

4) Tar unzip files and directories

TAR-XZVF [Compressed file]

Where the-x option represents unpacking, the-V option indicates that details are displayed, the-F option indicates the specified decompression file, and the-Z option indicates decompression and is extracted to the current directory

5) Zip compressed files and directories

The Zip command is used to compress a file or directory , where the path is/usr/bin/zip, with the syntax in the following format:

Zip option [-r] [filename after compression] [file or directory]

Where the-r option represents a compressed directory, and the compressed file format is. zip.

. zip default Windows and Linux only common format

6) Unzip

The Unzip command is used to extract the. zip file , where the path is/usr/bin/unzip, with the syntax in the following format:

Unzip [compressed file]

?

7) Bzip2: can only compress files

Bzip2 is an upgraded version of Gzip and is also used to compress files , where the path is/USR/BIN/BZIP2, with the syntax in the following format:

BZIP2 option [-K] [file]

Where the -K option produces a compressed file after preserving the source file. The compressed file format is. bz2.

Use the tar command to save the directory as a. bz2 file in the following format:

Tar options [-CJVF] [file name after compression] [directory]

Where the-J option means that the compression is a. tar.bz2 file .

?

8) BUNZIP2

The bunzip2 command is used to decompress the. bz2 file , where the path is/USR/BIN/BUNZIP2, with the syntax format:

BUNZIP2 option [-K] [compressed file]

Where- k indicates that the source file is preserved after decompression .

The tar command can also be used to decompress. bz2 files in the format:

Tar options [-XJVF] [Compressed Files]

4_linux_ file compression and decompression instructions

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.