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
Samira
17 hours ago
But it’s empty, so E) won’t apply here.
upvoted 0 times
...
Glenna
6 days ago
Yeah, B) and maybe E) could work if Downloads had files.
upvoted 0 times
...
Blair
11 days ago
I don't think A) is valid.
upvoted 0 times
...
Samira
16 days ago
Also, A) undir Downloads sounds like a good option, but I’m not sure.
upvoted 0 times
...
Glenna
21 days ago
Agreed, rmdir is definitely correct.
upvoted 0 times
...
Samira
27 days ago
I think B) rmdir Downloads is the right choice. It removes empty directories.
upvoted 0 times
...
Blair
1 month ago
I feel confused about this question.
upvoted 0 times
...
Kristeen
1 month ago
B is the only correct answer here, no doubt!
upvoted 0 times
...
Sommer
1 month ago
Wait, you can't just use rm for empty directories?
upvoted 0 times
...
Leana
2 months ago
Definitely B and maybe A, but A seems sketchy.
upvoted 0 times
...
Maurine
2 months ago
I thought rm could handle directories too?
upvoted 0 times
...
Lindsey
2 months ago
B) rmdir Downloads is the right choice!
upvoted 0 times
...
Antonio
2 months 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
2 months 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
2 months ago
I feel like rmdir is definitely one of the options, but I'm not sure about the other one.
upvoted 0 times
...
Tatum
3 months 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