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
Leana
2 days ago
Definitely B and maybe A, but A seems sketchy.
upvoted 0 times
...
Maurine
7 days ago
I thought rm could handle directories too?
upvoted 0 times
...
Lindsey
12 days ago
B) rmdir Downloads is the right choice!
upvoted 0 times
...
Antonio
18 days ago
I’m a bit confused about the options. I don’t think any of the other commands are valid for removing directories.
upvoted 0 times
...
Jordan
23 days ago
I practiced a similar question where we had to delete empty directories, and I think rmdir was the answer there too.
upvoted 0 times
...
Lajuana
28 days ago
I feel like rmdir is definitely one of the options, but I'm not sure about the other one.
upvoted 0 times
...
Tatum
1 month ago
I think I remember that to remove a directory, you can't just use rm unless you add a specific option.
upvoted 0 times
...

Save Cancel