Courseiva
Essential Commands →mediumMultiple Choice

LFCS Essential Commands Practice Question

A support engineer must copy the directory /srv/appdata, including every subdirectory, hidden file, and preserved permission bits and timestamps, to /backup/appdata on the same host. Which command accomplishes this?

⚠ Common exam trap

The trap here is assuming any recursive copy preserves metadata, when only archive mode does so reliably.

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 /srv/appdata /backup/appdata

Archive-mode copy is the correct tool when a directory tree must be duplicated with metadata intact, since it combines recursion with preservation of permissions, ownership, timestamps, and symlink structure. Recursive-only copy drops metadata, relocation deletes the source, and a bare rsync invocation without archive or recursive flags will not descend into directories.

Answer analysis

Option-by-option breakdown

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

  • ✗

    mv /srv/appdata /backup/appdata

    Why it's wrong here

    mv relocates the source rather than copying it, so the original directory disappears from /srv. The scenario asks for a copy while keeping the original in place, so moving the data would break the running application and does not satisfy the backup requirement at all.

  • ✗

    rsync /srv/appdata /backup/appdata

    Why it's wrong here

    Without -a or -r, rsync skips directories entirely and prints a message that it is skipping directory. Even if it did copy, a missing trailing slash changes semantics, and the default behavior would not preserve the full metadata set, so this bare invocation cannot fulfill the request.

  • ✓

    cp -a /srv/appdata /backup/appdata

    Why this is correct

    The -a flag is archive mode, equivalent to -dR --preserve=all, so it recurses into subdirectories, copies symlinks as symlinks, and preserves mode, ownership where permitted, timestamps, and extended attributes. That matches the requirement to retain hidden files, permissions, and times in a single invocation on the same host.

  • ✗

    cp -r /srv/appdata /backup/appdata

    Why it's wrong here

    Plain -r copies recursively but does not guarantee preservation of timestamps, ownership, or extended attributes, and newer GNU coreutils may copy symlinks as their targets. The engineer explicitly needs permission bits and timestamps preserved, so the recursive-only form leaves metadata behind and is insufficient here.

About these practice questions

One of 406 original LFCS practice questions on Courseiva, each with a full explanation and wrong-answer analysis — not exam dumps or protected exam content. Learn why practice questions differ from exam dumps →

How Courseiva writes practice questions · Editorial policy

JA

Written and reviewed by Johnson Ajibi, MSc IT Security

Senior Network & Security Engineer · founder of Courseiva

Last reviewed September 2026 · checked against the official Linux Foundation exam blueprint

This LFCS practice question is part of Courseiva's free Linux Foundation 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 LFCS exam.