Difficulty: Easy
Correct Answer: cp programs/wb misc/wbx
Explanation:
Introduction / Context:
File management on Unix commonly involves copying files between directories and optionally renaming them in the process. The cp utility provides a simple syntax to specify a source path and a destination path that may include a new filename.
Given Data / Assumptions:
Concept / Approach:
The cp command takes the form cp source destination. If destination refers to a directory, cp copies into that directory with the same filename; if destination includes a trailing filename, the file is copied and simultaneously renamed. This is ideal for duplicating and renaming in one step.
Step-by-Step Solution:
Verification / Alternative check:
After running the command, ls -l misc/wbx should list the new file. The original programs/wb remains unchanged. Optionally, compare checksums with sum or md5sum to confirm identity.
Why Other Options Are Wrong:
Common Pitfalls:
Forgetting quotes when paths contain spaces; overwriting existing files unintentionally (use cp -i for interactive prompts). For recursive directory copies, use cp -r, but for single files the basic cp is sufficient.
Final Answer:
cp programs/wb misc/wbx
Discussion & Comments