LPI
010-160 · Question #88
010-160 Question #88: Real Exam Question with Answer & Explanation
The correct answer is B: cp -r /etc/* /root. Recursively copying a directory and its subdirectories in Linux requires the cp command with the -r flag.
The Power of the Command Line
Question
Which command copies the contents of the directory /etc/, including all sub-directories, to /root/?
Options
- Acopy /etc/ /root
- Bcp -r /etc/* /root
- Ccp -v /etc/* /root
Explanation
Recursively copying a directory and its subdirectories in Linux requires the cp command with the -r flag.
Common mistakes.
- A. copy is not a standard Linux command - it does not exist in the base GNU coreutils and would result in a command not found error.
- C. The -v flag enables verbose output showing each file as it is copied but does not enable recursive directory copying, so subdirectories would not be included.
Concept tested. Linux cp command recursive directory copy
Topics
#cp command#recursive copy#directory copy#file management
Community Discussion
No community discussion yet for this question.