[]gunzip and unzip unzip files to the specified directory

Source: Internet
Author: User
Linux commonly used compression commands are gzip and zip, the end of the two compression packages are different: Zip compressed after the file is *.zip, and gzip compressed files *.gz
The corresponding decompression commands are gunzip and unzip.

gzip Command:
# gzip Test.txt
It will compress the file into a file test.txt.gz, the original file is not, the decompression is the same

# Gunzip Test.txt.gz
It will unzip the file to file Test.txt, the original file is not, in order to retain the original file, we can add-C option and take advantage of Linux redirection

# gzip-c Test.txt >/root/test.gz
This will not only keep the original file, but also can put the compressed package into any directory, the decompression is the same

# gunzip-c/root/test.gz >/test.txt


Zip command:
# Zip Test.zip test.txt
It compresses the Test.txt file into Test.zip, and of course, you can specify the directory of the compressed package, for example/root/test.zip

# Unzip Test.zip
It will extract the file to the current directory by default, and if you want to extract to the specified directory, you can add the-d option

# Unzip test.zip-d/root/


Reference: http://www.iteye.com/topic/1036348

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.