Deal of The Day! Hurry Up, Grab the Special Discount - Save 25% - Ends In 00:00:00 Coupon code: SAVE25
Welcome to Pass4Success

- Free Preparation Discussions

LPI 010-160 Exam - Topic 3 Question 68 Discussion

Running the command rm Downloads leads to the following error:rm: cannot remove 'Downloads/': Is a directoryWhich of the following commands can be used instead to remove Downloads, assuming Downloads isempty? (Choose two correct answers.)
B) rmdir Downloads and E) rm --r Downloads
A) undir Downloads
C) dir --r Downloads
D) rem Downloads

LPI 010-160 Exam - Topic 3 Question 68 Discussion

Actual exam question for LPI's 010-160 exam
Question #: 68
Topic #: 3
[All 010-160 Questions]

Running the command rm Downloads leads to the following error:

rm: cannot remove 'Downloads/': Is a directory

Which of the following commands can be used instead to remove Downloads, assuming Downloads is

empty? (Choose two correct answers.)

Show Suggested Answer Hide Answer
Suggested Answer: B, E

To remove a directory, you need to use a command that can delete directories, not just files. The rm command can only remove files by default, unless you use the -r option, which stands for recursive. This option tells rm to delete the directory and all of its contents, including subdirectories and files. The rmdir command can also remove directories, but only if they are empty. If the directory contains any files or subdirectories, rmdir will fail and display an error message. Therefore, the correct commands to remove Downloads, assuming it is empty, are rmdir Downloads and rm -r Downloads. The other commands are either invalid or do not work on directories.Reference:

Linux Essentials - Linux Professional Institute (LPI), section 2.3.1

LPI Linux Essentials Study Guide: Exam 010 v1.6, 3rd Edition, chapter 4, page 93.


Contribute your Thoughts:

0/2000 characters

Currently there are no comments in this discussion, be the first to comment!


Save Cancel