XK0-005 · Question #857
A systems administrator needs to compress log files using the .tar.bz2 format. Which of the following commands should the administrator use?
The correct answer is C. tar -cvjf logs.tar.bz2 /var/log/*. To create a tar.bz2 archive of log files, the tar command with the -c, -v, -j, and -f options is the appropriate method.
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/*
How the community answered
(21 responses)- B5% (1)
- C90% (19)
- D5% (1)
Why each option
To create a `tar.bz2` archive of log files, the `tar` command with the `-c`, `-v`, `-j`, and `-f` options is the appropriate method.
The `-t` option lists the contents of an archive, it does not create or compress, and `logs.car.bz2` contains a typo.
The `-z` option is used for `gzip` compression, not `bzip2` compression.
This command correctly creates a tar archive and compresses it using bzip2. The `c` option creates a new archive, `v` provides verbose output, `j` instructs `tar` to use `bzip2` for compression, and `f` specifies the name of the output archive file (`logs.tar.bz2`). `/var/log/*` indicates the files to be included.
The `-b` option sets the block size for an archive and is not used for specifying a compression algorithm like bzip2.
Concept tested: Linux tar and bzip2 compression
Source: https://man7.org/linux/man-pages/man1/tar.1.html
Topics
Community Discussion
No community discussion yet for this question.