Red Hat Certified System Administrator RHCSA · Free Practice Question Medium

Question 18

On rhel.server.com, compress a directory /usr/bin to the format /home/bin.tar.bz2 using the bzip2 command.

  • A

    # tar -jvf /home/bin.tar /usr/bin && bzip2 /home/bin.tar

  • B

    # tar -xf /home/bin.tar /usr/bin && bzip2 /home/bin.tar

  • C

    # tar -cjf /home/bin.tar.bz2 /usr/bin

  • D

    # tar -czf /home/bin.tar.bz2 /usr/bin

Reveal correct answer

Correct answer: C

Explanation

Answer:

Explanation

  1. Command Breakdown:

    • tar: This command is used for creating and manipulating tar archives.

    • -c: Creates a new archive.

    • -j: Compresses the archive using bzip2 compression, which is more efficient than gzip.

    • -f: Specifies the file name for the archive (/home/bin.tar.bz2).

    • /usr/bin: Specifies the directory to be archived.

  2. Alternative Method: If you prefer creating an uncompressed .tar file first and then compressing it with bzip2, use:

    • This creates an uncompressed bin.tar file and then compresses it to bin.tar.bz2.

Key Takeaway

Using -cjf directly is generally faster and simpler, making it ideal for the exam.

Discussion

Think the marked answer is wrong, or have a better explanation? Share it below — comments appear after review.

You must be logged in to post a comment.

Preparing For

Your Certification?

255+ certifications
Detailed explanations
Free PDF samples

Has All The Questions You Need