nerdexam
LPI

010-160 · Question #35

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…

The correct answer is B. rmdir Downloads E. rm 璞 Downloads. The rm command refuses to remove directories without additional flags; use rmdir for empty directories or rm -r for recursive removal.

Finding Your Way on a Linux System

Question

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)

Options

  • Aundir Downloads
  • Brmdir Downloads
  • Cdir 璞 Downloads
  • Drem Downloads
  • Erm 璞 Downloads

How the community answered

(45 responses)
  • A
    2% (1)
  • B
    87% (39)
  • C
    4% (2)
  • D
    7% (3)

Why each option

The rm command refuses to remove directories without additional flags; use rmdir for empty directories or rm -r for recursive removal.

Aundir Downloads

'undir' is not a valid Linux command and does not exist in any standard Linux distribution.

Brmdir DownloadsCorrect

The 'rmdir' command is specifically designed to remove empty directories, making it a valid choice when the Downloads directory contains no files or subdirectories.

Cdir 璞 Downloads

'dir' with a removal flag is not a valid Linux command for deleting directories.

Drem Downloads

'rem' is not a valid Linux shell command - it is associated with Windows batch scripting and has no equivalent function on Linux.

Erm 璞 DownloadsCorrect

The 'rm -r' command enables recursive deletion, which allows rm to remove a directory and all its contents - and also works correctly on empty directories.

Concept tested: Removing directories with rmdir and rm -r

Source: https://man7.org/linux/man-pages/man1/rmdir.1.html

Topics

#rmdir#rm command#directory removal#file management

Community Discussion

No community discussion yet for this question.

Full 010-160 Practice