A system administrator needs to create a compressed backup of the /var/log directory. Which command should they use to create a gzip-compressed archive file named log_backup.tar.gz?
The correct answer is tar -czvf log_backup.tar.gz /var/log because the options -c create a new archive, -z filter the archive through gzip for compression, -v produce verbose output, showing all processed files, and -f specify the filename of the archive. The incorrect options either do not specify gzip compression, which is required to produce a .gz file, or use options that perform actions other than creating an archive, such as extracting files or listing the contents of an archive.
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 does each tar option (-c, -z, -v, -f) do?
Open an interactive chat with Bash
What is the difference between gzip and other compression tools like bzip2 or xz?
Open an interactive chat with Bash
How can you verify the contents of a tar.gz file without extracting it?