Unzipping .gz
files in Linux is a common task that can be easily accomplished using built-in tools. This guide will walk you through the process step-by-step.
Using the gzip
Command
- Locate Your
.gz
File:
- First, ensure you know the location of your
.gz
file. For example, you might have a file namedexample.gz
.
- Extracting the
.gz
File:
- Open a terminal window.
- To extract the contents of
example.gz
and retain the original file, use the following command:
gzip -d example.gz - This will decompress
example.gz
and create a file namedexample
without the.gz
extension
Using gunzip
- Alternative Method with
gunzip
:
gunzip
is another command-line utility specifically for decompressing.gz
files.- To achieve the same result as above, you can use:
gunzip example.gz
- This command will also decompress
example.gz
and produceexample
as the output file.
Conclusion
Unzipping .gz
files on Linux is straightforward with commands like gzip
and gunzip
, which are pre-installed on most distributions. These utilities provide a quick and efficient way to extract compressed files without the need for additional software.
Next time you need to decompress a .gz
file on Linux, refer back to this guide for simple and effective solutions using built-in tools. Happy extracting!
This guide focuses on practical steps for unzipping .gz
files on Linux using command-line utilities, omitting unnecessary details.