CompTIA Linux+ Certification Practice Exam

Access More Questions
In Linux, which command would you use to remove a directory?
Correct Answer:
rmdir
Explanation:
The command used to remove a directory in Linux is "rmdir." This command specifically focuses on deleting empty directories from the file system. When executed, it checks if the specified directory is empty and, if so, removes it. If the directory contains files or other directories, the command will return an error, preventing accidental deletion of non-empty directories. In contexts where you need to delete a directory that contains files or subdirectories, a different command (not listed in the choices here) is typically used, such as "rm -r," which removes directories and their contents recursively. The other provided options serve different functions; "rm" is primarily for removing files, "mkdir" creates new directories, and "mv" is used for moving or renaming files and directories, rather than deleting them.

Access more questions from this quiz

Continue to CompTIA Linux+ Certification Practice Exam for more practice questions and the full quiz experience.

Access More Questions