PrepAway - Latest Free Exam Questions & Answers

Which of the following commands will he use to accomplish the task?

John works as a Network Administrator for Perfect Solutions Inc. The company has a Linux-based
network. John is working as the root user on the Linux operating system. He wants to copy all files
with the .dat extension from /home/john to /home/maria while preserving the file attributes, such as
timestamps, mode, and ownership. Which of the following commands will he use to accomplish
the task?

PrepAway - Latest Free Exam Questions & Answers

A.
cp -p /home/john/*.dat /home/maria

B.
cp -R /home/john/*.dat /home/maria

C.
cp -l /home/maria/*.dat /home/john

D.
cp -l /home/john/*.dat /home/maria

Explanation:

According to the scenario, since John wants to copy all files with the .dat extension from
/home/john
to /home/maria while preserving the file
attributes such as timestamps, mode, and ownership, he will use the cp -p /home/john/*.dat
/home/maria command to accomplish the task. The cp -p command copies files from source to
destination while preserving the file attributes, such as timestamps, mode, and ownership.
Answer option B is incorrect. The cp -R /home/john/*.dat /home/maria command will recursively
copy all .dat files from source to destination; however, it will not preserve the file attributes.
Answer option D is incorrect. The cp -l /home/john/*.dat /home/maria command will link all .dat
files from /home/john to /home/maria instead of copying them.
Answer option C is incorrect. The cp -l /home/maria/*.dat /home/john command will link all .dat
files from /home/maria to /home/john instead of copying them.


Leave a Reply