220-1102 exam dumps

220-1102 practice question 239 of 828

A+ Core 2. Associate level, CompTIA. Free question with the correct answer and a full explanation.

220-1102 Question 239

Single answerrm

A Linux technician is cleaning up an old user profile and needs to remove a directory named /home/jlee/archive along with all files and subdirectories inside it. The technician wants to complete the task from the command line in one step. Which command should they use?

  1. A

    rm /home/jlee/archive

  2. B

    rm -r /home/jlee/archive

  3. C

    rmdir /home/jlee/archive

  4. D

    del /home/jlee/archive

Show answer and explanation

Correct answer: B

Explanation

The correct command is rm -r /home/jlee/archive because rm with the recursive option is used to remove directories that contain files and subdirectories. In Linux administration and support tasks, this is a common command when cleaning up user data or old application folders. By contrast, rm without -r is intended for files, and rmdir is limited to empty directories. The del command belongs to Windows environments and would not be appropriate on a Linux system. As a best practice, technicians should verify the path carefully before running rm -r because it permanently deletes data without moving it to a recycle bin. This aligns with standard Linux command behavior documented in the rm and rmdir manual pages.

  • A. Incorrect.

    This is incorrect because rm without options removes files, not non-empty directories. If /home/jlee/archive contains files or subdirectories, this command will fail with a message indicating that it is a directory.

  • B. Correct.

    This is correct because the -r option makes rm recursive, allowing it to delete a directory and all of its contents in one command. This is the standard Linux method for removing non-empty directories from the command line.

  • C. Incorrect.

    This is incorrect because rmdir only removes empty directories. In this scenario, the directory contains files and subdirectories, so rmdir would not complete the task unless everything inside had already been removed.

  • D. Incorrect.

    This is incorrect because del is a DOS/Windows command, not the standard Linux command used in this scenario. A candidate might choose it by confusing Windows command-line syntax with Linux command-line tools.

Timed practice exam

Take a 220-1102 practice test under exam conditions

90 questions in 90 minutes, drawn from this bank, with a score report and a per-question review when you finish.

Start timed exam