Operating Systems

A technician must duplicate /home/sam/projects, including all its subdirectories, into /backup while leaving the original in place. Which command does this?

Show the answer

Correct answerD. cp -r /home/sam/projects /backup

AWhy not this: Reverses source and destination, copying the backup over the projects directory.

BWhy not this: Moves the directory, so the original no longer exists in its old location.

CWhy not this: Lacks the recursive option, so cp refuses to copy the directory.

DWhy this is right: Recursively copies the directory and its subdirectories; the original remains.

cp -r copies a directory and everything beneath it, and the source stays in place. Plain cp skips directories without -r, and mv would remove the original.