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

Study for the AP Networking Test. Use flashcards and multiple-choice questions for effective learning. Equip yourself with hints and explanations to ensure exam success. Get ready to excel!

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 Passetra

You can unsubscribe at any time. Read our privacy policy