A systems administrator must clean up all application files in the directory /var/log/app.
However, the company's security policy requires the files to be kept on the backup server for one year.
The Linux server has only the tar and bzip2 packages installed.
Which of the following commands will package and compress the files?
Click on the arrows to vote for the correct answer
A. B. C. D.B.
The correct answer is B. tar "jcvf applicationfiles.tar.bz2 /var/log/app/*
Explanation: The tar
command is used to create an archive, also known as a tarball, of one or more files and directories. The tarball can then be compressed using various compression algorithms. In this case, we need to package and compress the files in the /var/log/app
directory into a single file.
The options used in the command are:
j
: use bzip2 compressionc
: create a new archivev
: verbosely list the files being processedf
: use the following filenameTherefore, the correct command to package and compress the files in the /var/log/app
directory using bzip2 compression is:
csstar "jcvf applicationfiles.tar.bz2 /var/log/app/*
Option A (tar "zcvf applicationfiles.tar.bz2 /var/log/app/*
) uses gzip compression (z
option) instead of bzip2, which is not specified in the question. So this is not the correct answer.
Option C (tar "cvf applicationfiles.tar.bz2 /var/log/app/*
) only creates an archive without compressing it. So this is not the correct answer.
Option D (tar "xvf applicationfiles.tar.bz2 /var/log/app/*
) is used to extract the files from an archive, not create one. So this is not the correct answer.