CompTIACompTIA
XK0-005 · Question #1852
XK0-005 Question #1852: Real Exam Question with Answer & Explanation
The correct answer is C: tar -cvjf logs.tar.bz2 /var/log/*. To create a tar archive and compress it using bzip2, the tar command with the -c, -v, -j, and -f options is the correct approach.
System Management
Question
A systems administrator needs to compress log files using the .tar.bz2 format. Which of the following commands should the administrator use?
Options
- Atar -cvtf logs.car.bz2 /var/log/*
- Btar -cvzf logs.tar.bz2 /var/log/*
- Ctar -cvjf logs.tar.bz2 /var/log/*
- Dtar -cvbf logs.tar.bz2 /var/log/*
Explanation
To create a tar archive and compress it using bzip2, the tar command with the -c, -v, -j, and -f options is the correct approach.
Common mistakes.
- A. The
-toption is used to list the contents of an archive, not to create or compress it, and-caris not a valid option for bzip2 compression. - B. The
-zoption is used for gzip compression, not bzip2 compression, so it would create a.tar.gzfile. - D. The
-boption sets the blocking factor of the archive, which is an advanced option and not used for selecting a compression algorithm like bzip2.
Concept tested. Archiving and compression with tar and bzip2
Topics
#tar command#File compression#bzip2#Linux commands
Community Discussion
No community discussion yet for this question.