Linux Essentials (010-160) — Question 77
Which command copies the contents of the directory /etc/, including all sub-directories, to /root/?
Answer options
- A. copy /etc /root
- B. cp -r /etc/* /root
- C. cp -v /etc/* /root
- D. rcp /etc/* /root
- E. cp -R /etc/*.* /root
Correct answer: B
Explanation
The correct answer is B, as the 'cp -r' command recursively copies directories and their contents. Option A is incorrect because it doesn't include the '-r' flag for recursive copying. Option C uses the '-v' flag for verbose output but still lacks recursion. Option D uses 'rcp', which is not suitable for local copying, and option E attempts to copy only certain file types due to the wildcard, which is not the requirement.