Bird
0
0

What is the effect of running rm -r archive on a directory named archive?

easy📝 Conceptual Q1 of 15
Linux CLI - File and Directory Operations
What is the effect of running rm -r archive on a directory named archive?
AIt deletes the directory only if it is empty.
BIt only deletes the files inside <code>archive</code> but keeps the directory.
CIt deletes the directory <code>archive</code> along with all files and subdirectories inside it.
DIt renames the directory <code>archive</code> to <code>archive_old</code>.
Step-by-Step Solution
Solution:
  1. Step 1: Understand the -r option

    The -r flag stands for recursive removal, meaning it deletes directories and their contents recursively.
  2. Step 2: Apply to archive directory

    Running rm -r archive removes the directory archive and everything inside it, including files and subdirectories.
  3. Final Answer:

    It deletes the directory archive along with all files and subdirectories inside it. -> Option C
  4. Quick Check:

    Recursive removal deletes all contents [OK]
Quick Trick: rm -r deletes directories and all contents recursively [OK]
Common Mistakes:
  • Thinking rm -r only deletes files, not directories
  • Assuming rm -r requires the directory to be empty
  • Confusing rm -r with renaming commands

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Linux CLI Quizzes