nerdexam
Cisco

200-901 · Question #372

Refer to the exhibit. A network engineer must copy the "config.txt" file from directory TEST to directory PROD. The copied file must also be renamed into "current.txt". Which command must be used to…

The correct answer is D. cp ./TEST/config.txt ./PROD/current.txt. The Linux cp command requires the source file as the first argument and the destination path (including the new filename) as the second argument.

Infrastructure and Automation

Question

Refer to the exhibit. A network engineer must copy the "config.txt" file from directory TEST to directory PROD. The copied file must also be renamed into "current.txt". Which command must be used to accomplish these tasks?

Exhibit

200-901 question #372 exhibit

Options

  • Acp ./PROD/current.txt ./TEST/config.txt
  • Bcp ./TESTi/current.txt ./PROD/config.txt
  • Ccp ./PROD/config.txt ./TEST/current.txt
  • Dcp ./TEST/config.txt ./PROD/current.txt

How the community answered

(52 responses)
  • A
    4% (2)
  • B
    8% (4)
  • C
    2% (1)
  • D
    87% (45)

Why each option

The Linux cp command requires the source file as the first argument and the destination path (including the new filename) as the second argument.

Acp ./PROD/current.txt ./TEST/config.txt

The source and destination are reversed, so this command would copy from PROD/current.txt to TEST/config.txt - the opposite of the required direction.

Bcp ./TESTi/current.txt ./PROD/config.txt

This command references a nonexistent path './TESTi/current.txt' due to a typo, and places the destination as PROD/config.txt, which copies from the wrong source and does not rename the file correctly.

Ccp ./PROD/config.txt ./TEST/current.txt

The source and destination are reversed, copying from PROD/config.txt to TEST/current.txt, which moves the file in the wrong direction and to the wrong directory.

Dcp ./TEST/config.txt ./PROD/current.txtCorrect

The command cp ./TEST/config.txt ./PROD/current.txt correctly places the source file (config.txt in TEST) first and the destination with the renamed target (current.txt in PROD) second, accomplishing both the copy and rename in a single cp operation.

Concept tested: Linux cp command for file copy and rename

Source: https://linux.die.net/man/1/cp

Topics

#Command Line Interface#File Management#Linux Commands#OS Commands

Community Discussion

No community discussion yet for this question.

Full 200-901 Practice