CompTIA

XK0-006 practice question 3

CompTIA Linux+ · free question 3 of 20

Question

A Linux systems administrator needs to extract the contents of a file named /home/dev/web.bkp to the /var/www/html/ directory. Which of the following commands should the administrator use?
  • A. cd /var/www/html/ && gzip -c /home/dev/web.bkp | tar xf -
  • B. pushd /var/www/html/ && cpio -idv < /home/dev/web.bkp && popd Correct
  • C. tar -c -f /home/dev/web.bkp /var/www/html/
  • D. unzip -c /home/dev/web.bkp /var/www/html/

Explanation

pushd changes into /var/www/html/, cpio -idv reads the archive from standard input and extracts it (-i) into the current directory, creating directories as needed (-d), and popd returns to the previous directory. Option A compresses the file with gzip -c instead of decompressing it, so tar receives gzip data rather than an archive. Option C creates a new archive (-c) and would overwrite the backup, and unzip -c only prints the files to standard output instead of extracting them to the directory.

Practice the whole free set

Answer all 20 free XK0-006 questions with instant feedback, or unlock all 154 questions with Learn and Exam modes.