nerdexam
CompTIA

XK0-004 · Question #294

A directory called /employee is shared with many employees in a company. New hardware was acquired, and the systems administrator needs to back up all files in /employee before the server is replaced.

The correct answer is A. tar -zcvf backup.tar.gz /employee. The tar command with -zcvf flags creates a new gzip-compressed archive of the /employee directory, satisfying both the backup and space-efficiency requirements.

System Management

Question

A directory called /employee is shared with many employees in a company. New hardware was acquired, and the systems administrator needs to back up all files in /employee before the server is replaced. Which of the following commands should be used to back up all the files and compress them to use little space in the filesystem?

Options

  • Atar -zcvf backup.tar.gz /employee
  • Btar -zxvf backup.tar.gz /employee
  • Ctar -Cvf backup.tar.gz /employee
  • Dtar -Tpf backup.tar.gz /employee

How the community answered

(31 responses)
  • A
    94% (29)
  • B
    3% (1)
  • C
    3% (1)

Why each option

The tar command with -zcvf flags creates a new gzip-compressed archive of the /employee directory, satisfying both the backup and space-efficiency requirements.

Atar -zcvf backup.tar.gz /employeeCorrect

The -z flag compresses the archive using gzip, -c creates a new archive rather than extracting, -v enables verbose output listing files as they are processed, and -f specifies the output filename. Together, these flags create a compressed tarball of the entire /employee directory, preserving all file contents while minimizing filesystem space usage.

Btar -zxvf backup.tar.gz /employee

The -x flag extracts files from an existing archive rather than creating one, so this command would attempt to decompress and unpack backup.tar.gz rather than back up /employee.

Ctar -Cvf backup.tar.gz /employee

The -C flag changes the working directory before performing operations and does not enable gzip compression, so the resulting archive would not be compressed.

Dtar -Tpf backup.tar.gz /employee

The -T flag reads a list of filenames from a specified file and -p preserves permissions, but neither flag enables gzip compression, so this command does not fulfill the compression requirement.

Concept tested: Creating compressed tar archives with gzip for backup

Source: https://linux.die.net/man/1/tar

Topics

#tar#compression#backup#archiving

Community Discussion

No community discussion yet for this question.

Full XK0-004 Practice