Linux commonly used compression commands have gzip and zip, two kinds of compression package end different: Zip Compressed after the file is *.zip, and gzip compressed file *.gz; The corresponding decompression command is gunzip and unzip
gzip Command:
# gzip Test.txt
It will compress the file into a file test.txt.gz, the original file is not, unzip the same
# Gunzip Test.txt.gz
It will unzip the file into a file Test.txt, the original file is not, in order to preserve the original file, we can add the-C option and take advantage of the Linux redirection
# gzip-c Test.txt >/root/test.gz
This will not only keep the original files, but also can put the compressed package in any directory, decompression is the same
# gunzip-c/root/test.gz >./test.txt
Zip command:
# Zip Test.zip test.txt
It compresses the Test.txt file to Test.zip, and you can also specify the directory of the compressed package, such as/root/test.zip
# Unzip Test.zip
It will unzip the file to the current directory by default, and if you want to extract it to the specified directory, you can add the-d option
# Unzip test.zip-d/root/
Description of the unzip command in Linux gzip and unzip