0
0
Linux CLIscripting~5 mins

gzip and gunzip in Linux CLI - Cheat Sheet & Quick Revision

Choose your learning style9 modes available
Recall & Review
beginner
What does the gzip command do in Linux?

The gzip command compresses files to save disk space. It creates a smaller version of the file with a .gz extension.

Click to reveal answer
beginner
How do you decompress a file named example.txt.gz using the command line?

You use the gunzip example.txt.gz command. It restores the original example.txt file by uncompressing it.

Click to reveal answer
beginner
What happens to the original file after running gzip filename?

The original file is replaced by the compressed file filename.gz. The original file is removed to save space.

Click to reveal answer
intermediate
How can you keep the original file after compressing it with gzip?

Use the -k option: gzip -k filename. This keeps the original file and creates a compressed copy.

Click to reveal answer
intermediate
What is the difference between gunzip and gzip -d?

Both commands decompress files. gunzip is a shortcut for gzip -d. They work the same way.

Click to reveal answer
Which command compresses a file named data.txt?
Agzip data.txt
Bgunzip data.txt
Cgzip -d data.txt
Dgunzip -k data.txt
What file extension does gzip add to compressed files?
A.gz
B.tar
C.zip
D.gzip
How do you decompress a file named archive.gz?
Agzip archive.gz
Bgunzip archive.gz
Cgzip -k archive.gz
Dgzip -c archive.gz
Which option keeps the original file when compressing with gzip?
A-d
B-c
C-r
D-k
What happens to the original file after running gzip filename without options?
AIt stays unchanged
BIt is copied to a backup folder
CIt is deleted and replaced by compressed file
DIt is renamed to filename.old
Explain how to compress and decompress files using gzip and gunzip commands.
Think about what happens to the file before and after compression.
You got /3 concepts.
    Describe the difference between using gunzip and gzip -d for decompression.
    Consider command shortcuts and options.
    You got /3 concepts.