← All sims

PBQ3 - Linux Backup and Restore

Interactive Performance-Based Question Walkthrough - CompTIA Linux+ / LPIC Study Reference
Scenario: You are a systems administrator. You created an uncompressed backup of the application directory, which lives at /opt/application. Several hours later, you must restore the application from that backup. Click the tokens below, in the correct order, to build each tar command. Every click is explained, right or wrong.
Goal: Create an uncompressed tar archive of the application directory (located at /opt/application) and save it to /backups/application.tar, using -C so the archive stores the relative name application instead of an absolute path.
Step 1 of 9: click the flag that CREATES a new archive.
$tar ...
Flag-by-Flag Breakdown (correct answer)

tar -cvf /backups/application.tar -C /opt/ application

  • -c (create) - Tells tar to create a new archive. Without this flag tar does not know to write a new file.
  • -v (verbose) - Prints the name of each file as it is added. Useful for confirming what is being archived.
  • -f (file) - Specifies that the next argument is the archive filename. Always required when writing to a named file rather than stdout.
  • /backups/application.tar - The destination archive path. The .tar extension confirms the archive is uncompressed.
  • -C - Changes tar's working directory to what follows, before it starts archiving. This lets you reference the source folder by a relative name instead of its full path.
  • /opt/ - The directory to change into. The application folder actually lives at /opt/application, so tar needs to be pointed there first.
  • application - The source directory being archived, given as a relative name (relative to /opt/) so the archive doesn't store an absolute path.
Why the Other Tokens Are NOT Used
  • -xvf - x means extract. You are creating, not extracting, so this is wrong for the backup tab.
  • -xzvf / -xjvf / -cJvf - These include compression flags (z = gzip, j = bzip2, J = xz). The scenario says uncompressed.
  • -tvf - t means list/test archive contents. Not used for creation or extraction.
  • -d - Compares archive to file system. Not needed here.
  • -c (standalone) - Lacks -v and -f; incomplete for this task.
  • /backups/application.tar.gz / .tgz / .tar.bz2 - These imply compression. Wrong for an uncompressed backup.
  • /, /home/ - Directory paths unrelated to this scenario; the application directory lives under /opt/, not here.
Goal: Extract the previously created uncompressed archive /backups/application.tar to restore the application to its original location, /opt/application.
Step 1 of 7: click the flag that EXTRACTS an archive.
$tar ...
Flag-by-Flag Breakdown (correct answer)

tar -xvf /backups/application.tar -C /opt/

  • -x (extract) - Tells tar to read the archive and restore its contents to the file system.
  • -v (verbose) - Lists each file as it is extracted, confirming the restore is progressing correctly.
  • -f (file) - Specifies that the next argument is the archive file to read from.
  • /backups/application.tar - The source archive path created during the backup step. Matching the .tar extension confirms no decompression flag is needed.
  • -C - Changes tar's working directory to what follows, before it extracts. Because the archive stores the relative name application, not an absolute path, tar needs to be told where to put it back.
  • /opt/ - The directory to extract into, so application is restored to /opt/application, its original location.
Why the Other Tokens Are NOT Used
  • -cvf - c means create. You are restoring (extracting), not creating a new archive.
  • -xzvf - The z flag calls gzip decompression. The backup is uncompressed (.tar), so no decompression flag is needed.
  • -xjvf - j calls bzip2 decompression. Same reason as above, not applicable.
  • -cJvf - Incorrect on both counts: c is for creation, and J is xz compression.
  • application - Not needed as a standalone token during restore. The archive already contains this relative path internally; tar recreates it under whichever directory -C points to.
  • /backups/application.tar.gz / .tgz / .tar.bz2 - These do not match the uncompressed backup file that was actually created.
Quick-Reference Summary
TabCommandKey Flags
Backuptar -cvf /backups/application.tar -C /opt/ application-c (create), -C (change dir)
Restoretar -xvf /backups/application.tar -C /opt/-x (extract), -C (change dir)
Exam Tips