Which command would you use to move a file named report.txt to a directory named reports?

Prepare for the AP Networking Test. Study with flashcards and multiple choice questions, each question includes hints and explanations. Boost your confidence and get ready for success!

Multiple Choice

Which command would you use to move a file named report.txt to a directory named reports?

Explanation:
Moving a file into an existing directory is done with the mv command. When the destination is a directory, mv relocates the source file into that directory while keeping the same filename. So report.txt would go into the directory named reports with the command mv report.txt reports (you can also use mv report.txt reports/). The other commands don’t achieve this: cp would copy the file, leaving the original intact; mkdir creates a directory but doesn’t move files; ls just lists contents and doesn’t modify files.

Moving a file into an existing directory is done with the mv command. When the destination is a directory, mv relocates the source file into that directory while keeping the same filename. So report.txt would go into the directory named reports with the command mv report.txt reports (you can also use mv report.txt reports/).

The other commands don’t achieve this: cp would copy the file, leaving the original intact; mkdir creates a directory but doesn’t move files; ls just lists contents and doesn’t modify files.

Subscribe

Get the latest from Examzify

You can unsubscribe at any time. Read our privacy policy