CompTIA Linux+ (XK0-004) — Question 316
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?
Answer options
- A. tar -zcvf backup.tar.gz /employee
- B. tar -zxvf backup.tar.gz /employee
- C. tar -Cvf backup.tar.gz /employee
- D. tar -Tpf backup.tar.gz /employee
Correct answer: A
Explanation
The correct answer, A, uses the 'tar' command with the '-z' option to compress files while creating an archive, which is ideal for saving space. Option B is incorrect because it attempts to extract files rather than create a backup. Option C is wrong as it lacks the compression flag needed for space efficiency. Option D is also incorrect because it refers to listing files from an archive without creating a backup.