A system administrator is tasked with archiving a large directory of text-based log files for long-term storage. The primary requirement is to minimize the archive's size on disk, and the time taken to perform the compression is not a concern. Which of the following commands should the administrator use to create a single compressed archive file that meets this goal?
The correct command is tar -cJf logs.tar.xz /path/to/logs. The xz compression tool, used by the -J flag in the tar command, provides the highest compression ratio among the common Linux tools, which is ideal for long-term storage where minimizing size is the priority and time is not a factor. The -z flag uses gzip, which prioritizes speed over compression ratio. The -j flag uses bzip2, which offers a balance between speed and compression but is generally not as high as xz. The gzip -r command would compress each file within the directory individually rather than creating the single archive file requested in the scenario.
Ask Bash
Bash is our AI bot, trained to help you pass your exam. AI Generated Content may display inaccurate information, always double-check anything important.
What is the advantage of using `xz` compression over `gzip` or `bzip2`?
Open an interactive chat with Bash
What is the difference between compressing with `gzip -r` and using `tar` with compression?
Open an interactive chat with Bash
What is the purpose of the `-cJf` options in the `tar` command?
Open an interactive chat with Bash
CompTIA Linux+ XK0-006 (V8)
System Management
Your Score:
Report Issue
Bash, the Crucial Exams Chat Bot
AI Bot
Loading...
Loading...
Loading...
IT & Cybersecurity Package Join Premium for Full Access