0
0
Linux CLIscripting~5 mins

bzip2 and xz compression in Linux CLI - Cheat Sheet & Quick Revision

Choose your learning style9 modes available
Recall & Review
beginner
What is the main purpose of bzip2 and xz commands in Linux?
They are used to compress and decompress files to save disk space and reduce transfer time.
Click to reveal answer
beginner
How do you compress a file named file.txt using bzip2?
Run the command bzip2 file.txt. It creates file.txt.bz2 and removes the original file.
Click to reveal answer
beginner
How do you decompress a .xz file named archive.xz?
Use the command unxz archive.xz or xz -d archive.xz. It restores the original file and removes the compressed one.
Click to reveal answer
intermediate
Which compression tool generally provides better compression ratio: bzip2 or xz?
xz usually compresses files smaller than bzip2, but it may take more time to compress.
Click to reveal answer
intermediate
How can you keep the original file after compressing with bzip2?
Use the -k option: bzip2 -k file.txt keeps file.txt and creates file.txt.bz2.
Click to reveal answer
What file extension does bzip2 compression create?
A.gz
B.xz
C.bz2
D.zip
Which command decompresses an .xz file?
Aunxz file.xz
Bbzip2 -d file.xz
Cgzip -d file.xz
Dxz -c file.xz
How to compress a file with xz and keep the original file?
Axz file.txt
Bxz -k file.txt
Cxz -d file.txt
Dxz --remove file.txt
Which tool is usually faster at compressing files?
Axz
BNeither compresses files
CBoth are equally fast
Dbzip2
What happens to the original file after running bzip2 file.txt without options?
AIt is deleted
BIt is renamed
CIt stays unchanged
DIt is copied
Explain how to compress and decompress files using both bzip2 and xz commands.
Think about the commands and file extensions for both tools.
You got /6 concepts.
    Compare bzip2 and xz in terms of compression ratio and speed.
    Focus on size and speed differences.
    You got /5 concepts.