nerdexam
CompTIA

XK0-005 · 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…

The correct answer is A. tar -zcvf backup.tar.gz /employee. To back up and compress files using tar, the correct command combines options for creation, verbosity, compression, and specifying the archive file and source directory.

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
  • Dtar -Tpf backup.tar.gz /employee

How the community answered

(56 responses)
  • A
    80% (45)
  • B
    7% (4)
  • D
    13% (7)

Why each option

To back up and compress files using `tar`, the correct command combines options for creation, verbosity, compression, and specifying the archive file and source directory.

Atar -zcvf backup.tar.gz /employeeCorrect

The `tar -zcvf backup.tar.gz /employee` command uses `-z` for gZip compression, `-c` to create a new archive, `-v` for verbose output (showing files being added), and `-f` to specify the archive file name (`backup.tar.gz`) followed by the source directory (`/employee`). This effectively backs up and compresses the specified directory.

Btar -zxvf backup.tar.gz /employee

The `-x` option is used to extract files from an archive, not to create one.

Dtar -Tpf backup.tar.gz /employee

The `-T` option is used to read file names to be archived from a file, and `-p` preserves permissions, but it lacks the `-c` (create) and `-z` (compress) options needed for the stated goal.

Concept tested: Tar archive creation with gzip compression

Source: https://man7.org/linux/man-pages/man1/tar.1.html

Topics

#tar command#File archiving#File compression#Linux backups

Community Discussion

No community discussion yet for this question.

Full XK0-005 Practice