gunzip Command in Linux
Build an AI-First Career, Master the Complete Skillset
Choose from our industry-leading programs designed for career success
Modern Software and AI Engineering Program
Master full-stack development with AI integration
+1000 moreModern Data Science and ML with specialisation in AI
Advanced data science techniques with AI specialization
+1000 moreAdvanced AIML with Specialisation in Agentic AI
Deep dive into AIML with focus on Agentic systems
+1000 moreDevOps, Cloud & AI Platform Engineering
Build and manage AI-powered cloud infrastructure
+1000 moreAI Engineering Advanced Certification by IIT-Roorkee
Premier AI engineering certification from IIT-Roorkee
AI Forward Deployed Engineer Program
Full-stack engineering, production AI and client-facing consulting
+1000 moreOverview
The gunzip command in Linux is a widely-used utility for decompressing files compressed using the gzip algorithm. This command is particularly helpful when dealing with large files or transferring files over a network with limited bandwidth. In this article, we will explore the syntax, options, and use cases of the gunzip command.
Linux gunzip Command Syntax
The syntax for the gunzip command is as follows:
Where:
- options: These are the flags that modify the behavior of the gunzip command.
- file: This is the compressed file that needs to be decompressed.
gunzip Command Options:
- -c: Write the decompressed data to standard output, leaving the original file unchanged.
- -f: Force overwriting of output files if they already exist.
- -k: Keep the input files, not deleting them after decompression.
- -l: List information about the compressed file, without actually decompressing it.
Example Usages
-
Basic usage of gunzip command:
Output:
Explanation: This command decompresses the 'file.gz' and creates a new file named 'file' in the same directory.
-
Using the -c option:
Output:
Explanation: This command writes the decompressed data to standard output and then redirects it to a new file, leaving the original compressed file unchanged.
How Scaler Transformed Careers in Different Fields
Scaler learners achieved 2.5x salary growth with average post-Scaler CTC reaching ₹23L.
Tips
- Use the gzip command to compress files before using gunzip to decompress them.
Advanced Use Cases of gunzip Command in Linux
-
Decompress multiple files:
Output:
Explanation: This command decompresses multiple compressed files in a single command.
-
Using the -l option:
Output:
Explanation: This command lists information about the compressed file without decompressing it, such as the compression ratio and uncompressed file size.
Turn Learning into Career Growth
Conclusion
-
The gunzip command is an essential tool for decompressing gzip compressed files in Linux.
-
Various options like -c, -f, -k, and -l modify the behavior of the command.
-
Gunzip can be used with multiple files and in combination with other commands.