Which command would you use to copy a file named data.txt to the directory /backup?

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 copy a file named data.txt to the directory /backup?

Explanation:
Copying a file to another location uses the copy command. In Unix-like environments, that command is cp. Here, you want to duplicate data.txt into the directory /backup, so the correct action is cp data.txt /backup. This copies the file into that directory without removing the original, resulting in /backup/data.txt while data.txt remains where it was. The other commands don’t perform copying: moving would relocate the file and remove it from its original place; creating a directory (mkdir) makes a new directory, not a file; listing (ls) shows contents but doesn’t copy anything.

Copying a file to another location uses the copy command. In Unix-like environments, that command is cp. Here, you want to duplicate data.txt into the directory /backup, so the correct action is cp data.txt /backup. This copies the file into that directory without removing the original, resulting in /backup/data.txt while data.txt remains where it was.

The other commands don’t perform copying: moving would relocate the file and remove it from its original place; creating a directory (mkdir) makes a new directory, not a file; listing (ls) shows contents but doesn’t copy anything.

Subscribe

Get the latest from Examzify

You can unsubscribe at any time. Read our privacy policy