Linux Terminal Command: gunzip
The gunzip command is an essential tool in File Manipulation & Viewing. In this tutorial, we will explore what gunzip does, look at everyday examples, and cover advanced options to supercharge your command-line workflow.
Concept & Explanation
The gunzip command restores files compressed by gzip back to their original size and format.
Common Options & Syntax
gunzip [options] [arguments]
Here are the most common flags used with gunzip:
- Simple Usage: Basic default commands.
- Detailed View: Shows diagnostic information.
- Advanced Actions: Can chain parameters for scripting.
1. Interactive Example (Simple)
Here is how most people run the command:
# Example
gunzip data.gz
What it does: Decompresses ‘data.gz’ to ‘data’.
2. Power-User Example (Advanced)
For scripting and advanced diagnostics, use this configuration:
# Advanced
gunzip -c archive.tar.gz | tar -xf -
What it does: Decompresses ‘archive.tar.gz’ to stdout (-c) and pipes the stream directly to tar to extract it without writing intermediate files to disk.
⚙️ Warning & Common Pitfalls
[!WARNING] Like
gzip,gunzipdeletes the original compressed.gzfile after extraction unless the-k(keep) or-c(stdout) flag is provided.
🔗 Related Commands
Here are some related posts on cli_tty1 you might want to check out:
- gzip : Compress files.