In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-16 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)06/01 Report--
This article introduces the relevant knowledge of "how to use the gunzip command of Linux". Many people will encounter such a dilemma in the operation of actual cases, so let the editor lead you to learn how to deal with these situations. I hope you can read it carefully and be able to achieve something!
Gunzip is a widely used unzip command that is used to extract files compressed by gzip (with a .gz extension).
Gzip-d [compressed-file-name]
However, a completely different tool is available when unzipping or extending compressed files created by gzip. The tool I'm talking about is gunzip. In this article, we will use some simple, easy-to-understand examples to explain the use of the gunzip command. All the examples and guidelines in this article are tested in the environment of Ubuntu 16.04.
Linux gunzip command
We now know that compressed files can be unzipped with gzip-d or gunzip commands. The basic gunzip syntax is:
Gunzip [compressed-file-name]
The following Qaccouna example will show more clearly how the gunzip tool works:
Q1. How do I extract a file using gunzip?
The extract command is as simple as passing the name of the compressed file as an argument to the gunzip command.
Gunzip [archive-name]
For example:
Gunzip file1.gz
Linux-gunzip-commandexample
Q2. How do I keep gunzip from deleting the original compressed file?
As you have noticed, the gunzip command deletes the original compressed file when it is unzipped. If you want to keep the original compressed file, use the-c option.
Gunzip-c [archive-name] > [outputfile-name]
For example:
Gunzip-c file1.gz > file1
How do I keep gunzip from deleting the original compressed file?
In this way, the original compressed file will not be deleted.
Q3. How do I extract the file to another path with gunzip?
We have discussed the use of the-c option in QroomA. Using gunzip to extract the file to another path outside the working directory, you only need to add the absolute path to the target directory after the redirect operator.
Gunzip-c [compressed-file] > [/ complete/path/to/dest/dir/filename]
Examples are as follows:
Gunzip-c file1.gz > / home/himanshu/file1 more information
Gunzip accepts a series of files on the command line and starts each with the correct magic number and suffixes a compressed file with the name .gz,-gz, .z,-z, or _ z (ignoring case), replaces it with an uncompressed file, and removes its original extension. Gunzip can also recognize compressed files with special extensions, such as .tgz and .taz, which are abbreviations for .tar.gz and .tar.Z, respectively. When compressing, gzip uses .tgz as the extension if necessary, rather than just truncating the .tar suffix.
Gunzip can currently extract files generated by gzip, zip, compress, compress-H (pack). Gunzip automatically detects the input file format. When using the first two compression formats, gunzip verifies 32-bit cyclic redundancy check codes (CRC). For pack packages, gunzip verifies the compressed length. The standard compression format does not allow compatibility testing in design. However, gunzip can sometimes detect bad .Z files. If you make an error while unzipping the .Z file, don't assume that the .Z file must be correct just because the standard decompression did not report an error. This usually means that the standard decompression process does not detect its input, but directly produces an incorrect output. SCO's compress-H format (lzh compression method) does not include CRC check codes, but does allow some compatibility checks.
This is the end of the content of "how to use the gunzip command of Linux". Thank you for reading. If you want to know more about the industry, you can follow the website, the editor will output more high-quality practical articles for you!
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.