220-1102 exam dumps

220-1102 practice question 237 of 828

A+ Core 2. Associate level, CompTIA. Free question with the correct answer and a full explanation.

220-1102 Question 237

Single answermv

A Linux technician is cleaning up a user's home directory and needs to move the file report.txt from /home/jlee/Downloads to /home/jlee/Documents/Archive while renaming it to report-2024.txt in the same step. Which command should the technician use?

  1. A

    mv /home/jlee/Downloads/report.txt /home/jlee/Documents/Archive/report-2024.txt

  2. B

    cp /home/jlee/Downloads/report.txt /home/jlee/Documents/Archive/report-2024.txt

  3. C

    rename /home/jlee/Downloads/report.txt /home/jlee/Documents/Archive/report-2024.txt

  4. D

    mv /home/jlee/Documents/Archive/report-2024.txt /home/jlee/Downloads/report.txt

Show answer and explanation

Correct answer: A

Explanation

The mv command is the standard Linux utility used to move files or directories and to rename them. Its basic syntax is mv source destination. If the destination includes a different directory and filename, mv performs both actions at once. This is a common real-world administrative task when organizing user data. By contrast, cp creates a duplicate, and using the wrong source/destination order can move the wrong file or fail if the source does not exist. This aligns with standard Linux command-line usage documented in manual pages such as man mv.

  • A. Correct.

    Correct. The mv command can both move a file to a new directory and rename it in a single command by specifying the source path first and the destination path with the new filename second. This matches the requirement to relocate report.txt from Downloads to Documents/Archive and rename it to report-2024.txt.

  • B. Incorrect.

    Incorrect. The cp command copies a file rather than moving it. Using this command would leave the original file in /home/jlee/Downloads, which does not satisfy the requirement to move the file. A technician might choose this if they confuse copying with relocating.

  • C. Incorrect.

    Incorrect. rename is not the standard command for moving a file between directories in basic Linux administration, and its syntax and availability vary by distribution. In A+ level Linux file management tasks, mv is the correct and expected utility for moving and renaming files.

  • D. Incorrect.

    Incorrect. This reverses the source and destination. It attempts to move a file named report-2024.txt from the Archive directory back into Downloads as report.txt. Someone might choose this if they misunderstand the mv syntax order, which is source first, destination second.

Timed practice exam

Take a 220-1102 practice test under exam conditions

90 questions in 90 minutes, drawn from this bank, with a score report and a per-question review when you finish.

Start timed exam