nerdexam
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 -t option is used to list the contents of an archive, not to create or compress it, and -car is not a valid option for bzip2 compression.
  • B. The -z option is used for gzip compression, not bzip2 compression, so it would create a .tar.gz file.
  • D. The -b option 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

Reference. https://man7.org/linux/man-pages/man1/tar.1.html

Topics

#tar command#File compression#bzip2#Linux commands

Community Discussion

No community discussion yet for this question.

Full XK0-005 PracticeBrowse All XK0-005 Questions