0
0
Linux CLIscripting~5 mins

tar with compression (-z, -j, -J) in Linux CLI - Cheat Sheet & Quick Revision

Choose your learning style9 modes available
Recall & Review
beginner
What does the -z option do in the tar command?
The -z option tells tar to compress or decompress the archive using gzip compression.
Click to reveal answer
beginner
How do you create a bzip2 compressed tar archive named archive.tar.bz2?
Use tar -cjf archive.tar.bz2 foldername. The -j option enables bzip2 compression.
Click to reveal answer
intermediate
What compression does the -J option use in tar?
The -J option uses xz compression, which often provides better compression than gzip or bzip2.
Click to reveal answer
beginner
How to extract a gzip compressed tar archive named backup.tar.gz?
Use tar -xzf backup.tar.gz. The -x extracts, -z decompresses gzip, and -f specifies the file.
Click to reveal answer
intermediate
Why choose -J (xz) compression over -z (gzip) or -j (bzip2)?
Because xz usually compresses files smaller than gzip or bzip2, saving more space, but it may take longer to compress or decompress.
Click to reveal answer
Which tar option compresses using gzip?
A-J
B-j
C-z
D-x
What does the -j option do in tar?
AUse bzip2 compression
BUse gzip compression
CUse xz compression
DExtract files only
How do you extract an xz compressed tar archive named data.tar.xz?
Atar -xJf data.tar.xz
Btar -xjf data.tar.xz
Ctar -xzf data.tar.xz
Dtar -cf data.tar.xz
Which option is NOT used for compression in tar?
A-z
B-j
C-J
D-x
What command creates a gzip compressed archive named files.tar.gz from folder docs?
Atar -xzf files.tar.gz docs
Btar -czf files.tar.gz docs
Ctar -cJf files.tar.gz docs
Dtar -cjf files.tar.gz docs
Explain how to create and extract tar archives using gzip, bzip2, and xz compression options.
Think about the compression letter options and the basic tar commands for create and extract.
You got /6 concepts.
    What are the differences between gzip, bzip2, and xz compression when used with tar?
    Consider speed and compression quality differences.
    You got /4 concepts.