File Compression (gzip & gunzip)
Concept & Overview
Imagine you have a single text file containing a massive dataset, and you want to reduce its size to save disk space or speed up sharing. In Linux, we compress individual files using gzip and restore them using gunzip.
- The gzip command compresses a file, replacing it with a compressed version ending in .gz (e.g. backup.txt becomes backup.txt.gz).
- The gunzip command decompresses the file, restoring the original version.
gzip note.txt in your home folder. Then, decompress the resulting note.txt.gz file back to its original state by running gunzip note.txt.gz.Command Syntax Reference
| Command / Syntax | Description |
|---|---|
gzip note.txt | Compress note.txt to note.txt.gz |
gunzip note.txt.gz | Decompress note.txt.gz back to note.txt |
Verification Objectives
These conditions will be automatically verified when you run commands inside the interactive terminal simulator:
- ○Run the "gzip" command to compress note.txt
- ○Run the "gunzip" command to restore note.txt
Ready to complete Quest 123?
Test your skills live in the browser terminal with an emulated Linux filesystem, real-time command evaluation, and instant step-by-step hints.