Common compression and decompression commands in Linux

Source: Internet
Author: User
Tags bz2

The compression formats commonly used in Linux are. zip. gz. bz2. tar.gz. tar.bz2

One,. zip

1. Command format

Zip compressed filename source file name (zip file to current directory)

Zip-r compressed file name source directory name (compressed directory file to current directory)

Unzip compressed file name (unzip. zip file to current directory)

Description: Compressed files in the. zip format are common in Linux and Windows, and when the source files are compared for hours, compressed files may be larger than the original (compressed format conversion)

Ii.. gz

1. Command format

Gzip source files (compress files to current directory, source files are deleted)

Gzip-c source Files > Compressed files (compressed files to the current directory, with output redirection for source file retention)

Gzip-r directory (all files in the specified directory are compressed)

gzip-d compressed file (unzip the file to the current directory, the source file is deleted)

Gunzip Compressed Files ()

Description: the. gz format files in Linux can be decompressed in Windows

Iii.. bz2

1. Command format

bzip2 source files (source files are not preserved)

Bzip2-k source files (keep source files after compression)

bzip2-d compressed files (uncompressed, not preserving compressed files,-K preserving compressed files)

BUNZIP2 compressed files (uncompressed, not preserving compressed files,-K preserving compressed files)

Note: The bZIP command cannot compress the directory

Iv.. tar.gz

1.tar Command (Package command)

Command format: TAR-CVF package file name source file (-C package,-V display procedure,-f specifies the file name after packaging)

TAR-XVF Package file name (-X unpacking)

2.TAR.GZ (packaged and compressed)

Command format: TAR-ZCVF compressed package name. tar.gz source file (-Z compression to. tar.gz format)

TAR-ZXVF compressed package name. tar.gz (-X extract. tar.gz format)

TAR-ZCVF Path/Zip package name. tar.gz Source file 1 source file 2 (compresses multiple files individually to the. tar.gz format under the specified path)

TAR-ZTVF compressed package name. tar.gz (-t-Test to view files within a compressed package)

V.. tar.bz2

1. Command format

TAR-JCVF compressed package name. tar.bz2 source file (compressed to. tar.bz2 format)

TAR-JXVF compressed package name. TAR.BZ2 (uncompressed. tar.bz2 format)

TAR-JXVF compressed package name. Tar.bz2-c path (extracted to the specified path)

Common compression and decompression commands in 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.