Difficulty: Easy
Correct Answer: mv
Explanation:
Introduction / Context:In UNIX/Linux, file manipulation is performed by a small set of powerful commands. Renaming a file is conceptually the same as moving it within the same filesystem to a new name. The mv utility handles both rename and move actions.
Given Data / Assumptions:
Concept / Approach:
mv old new renames a file to a new name in the same directory. mv file dir/ moves a file to another directory, optionally changing the name (dir/new). Unlike copy, mv does not duplicate data; it updates directory entries. Across filesystems, mv effectively performs a copy-and-remove under the hood.
Step-by-Step Solution:
To rename: mv report.txt report_old.txtTo move (same name): mv report.txt archive/To move and rename: mv report.txt archive/report_2025.txtUse -i to prompt before overwriting an existing destination.Use -v for verbose output during batch operations.Verification / Alternative check:
Run ls or stat on the destination path to confirm the new name and location. When moving large files across filesystems, monitor disk usage to verify the copy-and-remove succeeded.
Why Other Options Are Wrong:
a: ren is a DOS/Windows command, not standard on UNIX.
c: remove is not the UNIX command (rm deletes files).
d: change is not a UNIX file utility.
e: Not applicable because mv is correct.
Common Pitfalls:
Overwriting existing files without -i; moving across filesystems unexpectedly (which can be slow); attempting to rename files without proper write permissions on the directory.
Final Answer:
mv
Discussion & Comments