Courseiva
mediumMultiple Choice

220-1102 Practice Question: Copy a directory tree from /home/user/docs to a…

A technician needs to copy a directory tree from /home/user/docs to a backup location /backup/docs, preserving all permissions, ownership, and timestamps. Which command should they use?

⚠ Common exam trap

CompTIA often tests the distinction between `-p` and `-a` by making candidates think preserving permissions and timestamps is sufficient, while the key requirement to preserve ownership is only met by `-a` (or running `-p` as root).

Answer choices

Why each option matters

Answer the question above first, then reveal the full breakdown to understand why each option is right or wrong.

Correct answer & explanation

✓

cp -a /home/user/docs /backup/docs

The `cp -a` (archive) command preserves all file attributes, including permissions, ownership, and timestamps, while recursively copying the entire directory tree. This is the most comprehensive single command for duplicating a directory with full metadata integrity.

Answer analysis

Option-by-option breakdown

For each option: why learners choose it and why it is or isn't the right answer here.

  • ✗

    cp -r /home/user/docs /backup/docs

    Why it's wrong here

    The -r flag copies recursively but does not preserve ownership or timestamps.

  • ✓

    cp -a /home/user/docs /backup/docs

    Why this is correct

    The `-a` (archive) flag bundles `-dR --preserve=all`, recursing through the tree while retaining permissions, ownership, timestamps, and symlinks. This directly satisfies the stem's requirement to preserve all three attributes during the copy from /home/user/docs to /backup/docs.

  • ✗

    cp -p /home/user/docs /backup/docs

    Why it's wrong here

    The -p flag preserves timestamps but does not copy recursively; it would fail on a directory.

  • ✗

    rsync -r /home/user/docs /backup/docs

    Why it's wrong here

    rsync with -r copies recursively but does not preserve permissions and ownership by default; -a would be needed.

About these practice questions

This 220-1202 question is part of Courseiva's 687-question bank — original exam-style content with full explanations and wrong-answer analysis, never real exam questions or exam dumps. Learn why practice questions differ from exam dumps →

How Courseiva writes practice questions · Editorial policy

JA

Written by Johnson Ajibi, MSc IT Security

Senior Network & Security Engineer · founder of Courseiva

This 220-1202 practice question is part of Courseiva's free CompTIA certification practice question bank. Courseiva provides original exam-style practice questions with explanations, topic-based practice, mock exams, readiness tracking, and study analytics to help learners prepare for the 220-1202 exam.