During a post-incident investigation you must safeguard every configuration file (*.conf) located anywhere under /etc that was modified within the last 48 hours. The files must be copied to /tmp/conf_backup and the original directory hierarchy has to be preserved so each file can later be restored to its exact path. Which single command meets these requirements?
The command has to (1) locate only .conf files below /etc, (2) restrict the results to files modified in the last two 24-hour periods (-mtime -2), (3) copy the matches to /tmp/conf_backup, and (4) reproduce the full path of every source file inside the target directory. The find expression "-type f -name ".conf" -mtime -2" satisfies the first two conditions. The GNU cp option "--parents" causes cp to re-create the entire path of each SOURCE beneath the destination directory, fulfilling the hierarchy requirement; using plain cp or cp --recursive would flatten the structure. Therefore only the command that combines find with -exec cp --parents /tmp/conf_backup ; accomplishes all of the stated goals. Using +2 would select files older than 48 hours, and omitting --parents would lose the directory layout.
Ask Bash
Bash is our AI bot, trained to help you pass your exam. AI Generated Content may display inaccurate information, always double-check anything important.
What does the '-mtime -2' option in the find command do?
Open an interactive chat with Bash
What is the purpose of the '--parents' option in the cp command?
Open an interactive chat with Bash
Why is the '-exec' option in the find command used instead of just piping to cp?
Open an interactive chat with Bash
CompTIA Linux+ XK0-006 (V8)
Services and User Management
Your Score:
Report Issue
Bash, the Crucial Exams Chat Bot
AI Bot
Loading...
Loading...
Loading...
IT & Cybersecurity Package Join Premium for Full Access